How many cores does my Mac have?
From a terminal you can see the difference between the number of physical processors and logical processors using sysctl:
$ sysctl hw.physicalcpu hw.logicalcpu
hw.physicalcpu: 4
hw.logicalcpu: 8
What am I missing?
Hyperthreading. You have 4 physical cores, but 8 logical ones.
For each processor core that is physically present, the operating system addresses two virtual (logical) cores and shares the workload between them when possible.
See also the Intel data on your processor, the i7 4870HQ:
# of Cores 4
Cores is a hardware term that describes the number of independent central processing units in a single computing component (die or chip).
# of Threads 8
A Thread, or thread of execution, is a software term for the basic ordered sequence of instructions that can be passed through or processed by a single CPU core.
What you see are so called hyperthreaded
cores.
For each physical core there are two hyperthreaded (or logical) cores, you can read up more about hyperthreading here