| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "v8.h" | 5 #include "v8.h" |
| 6 | 6 |
| 7 #if V8_TARGET_ARCH_IA32 | 7 #if V8_TARGET_ARCH_IA32 |
| 8 | 8 |
| 9 #include "bootstrapper.h" | 9 #include "bootstrapper.h" |
| 10 #include "codegen.h" | 10 #include "codegen.h" |
| (...skipping 2161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2172 ASSERT(argc >= 1 && generating_stub()); | 2172 ASSERT(argc >= 1 && generating_stub()); |
| 2173 ret((argc - 1) * kPointerSize); | 2173 ret((argc - 1) * kPointerSize); |
| 2174 } | 2174 } |
| 2175 | 2175 |
| 2176 | 2176 |
| 2177 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { | 2177 bool MacroAssembler::AllowThisStubCall(CodeStub* stub) { |
| 2178 return has_frame_ || !stub->SometimesSetsUpAFrame(); | 2178 return has_frame_ || !stub->SometimesSetsUpAFrame(); |
| 2179 } | 2179 } |
| 2180 | 2180 |
| 2181 | 2181 |
| 2182 void MacroAssembler::IllegalOperation(int num_arguments) { | |
| 2183 if (num_arguments > 0) { | |
| 2184 add(esp, Immediate(num_arguments * kPointerSize)); | |
| 2185 } | |
| 2186 mov(eax, Immediate(isolate()->factory()->undefined_value())); | |
| 2187 } | |
| 2188 | |
| 2189 | |
| 2190 void MacroAssembler::IndexFromHash(Register hash, Register index) { | 2182 void MacroAssembler::IndexFromHash(Register hash, Register index) { |
| 2191 // The assert checks that the constants for the maximum number of digits | 2183 // The assert checks that the constants for the maximum number of digits |
| 2192 // for an array index cached in the hash field and the number of bits | 2184 // for an array index cached in the hash field and the number of bits |
| 2193 // reserved for it does not conflict. | 2185 // reserved for it does not conflict. |
| 2194 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < | 2186 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) < |
| 2195 (1 << String::kArrayIndexValueBits)); | 2187 (1 << String::kArrayIndexValueBits)); |
| 2196 // We want the smi-tagged index in key. kArrayIndexValueMask has zeros in | 2188 // We want the smi-tagged index in key. kArrayIndexValueMask has zeros in |
| 2197 // the low kHashShift bits. | 2189 // the low kHashShift bits. |
| 2198 and_(hash, String::kArrayIndexValueMask); | 2190 and_(hash, String::kArrayIndexValueMask); |
| 2199 STATIC_ASSERT(String::kHashShift >= kSmiTagSize && kSmiTag == 0); | 2191 STATIC_ASSERT(String::kHashShift >= kSmiTagSize && kSmiTag == 0); |
| 2200 if (String::kHashShift > kSmiTagSize) { | 2192 if (String::kHashShift > kSmiTagSize) { |
| 2201 shr(hash, String::kHashShift - kSmiTagSize); | 2193 shr(hash, String::kHashShift - kSmiTagSize); |
| 2202 } | 2194 } |
| 2203 if (!index.is(hash)) { | 2195 if (!index.is(hash)) { |
| 2204 mov(index, hash); | 2196 mov(index, hash); |
| 2205 } | 2197 } |
| 2206 } | 2198 } |
| 2207 | 2199 |
| 2208 | 2200 |
| 2209 void MacroAssembler::CallRuntime(const Runtime::Function* f, | 2201 void MacroAssembler::CallRuntime(const Runtime::Function* f, |
| 2210 int num_arguments, | 2202 int num_arguments, |
| 2211 SaveFPRegsMode save_doubles) { | 2203 SaveFPRegsMode save_doubles) { |
| 2212 // If the expected number of arguments of the runtime function is | 2204 // If the expected number of arguments of the runtime function is |
| 2213 // constant, we check that the actual number of arguments match the | 2205 // constant, we check that the actual number of arguments match the |
| 2214 // expectation. | 2206 // expectation. |
| 2215 if (f->nargs >= 0 && f->nargs != num_arguments) { | 2207 CHECK(f->nargs < 0 || f->nargs == num_arguments); |
| 2216 IllegalOperation(num_arguments); | |
| 2217 return; | |
| 2218 } | |
| 2219 | 2208 |
| 2220 // TODO(1236192): Most runtime routines don't need the number of | 2209 // TODO(1236192): Most runtime routines don't need the number of |
| 2221 // arguments passed in because it is constant. At some point we | 2210 // arguments passed in because it is constant. At some point we |
| 2222 // should remove this need and make the runtime routine entry code | 2211 // should remove this need and make the runtime routine entry code |
| 2223 // smarter. | 2212 // smarter. |
| 2224 Move(eax, Immediate(num_arguments)); | 2213 Move(eax, Immediate(num_arguments)); |
| 2225 mov(ebx, Immediate(ExternalReference(f, isolate()))); | 2214 mov(ebx, Immediate(ExternalReference(f, isolate()))); |
| 2226 CEntryStub ces(isolate(), | 2215 CEntryStub ces(isolate(), |
| 2227 1, | 2216 1, |
| 2228 CpuFeatures::IsSupported(SSE2) ? save_doubles | 2217 CpuFeatures::IsSupported(SSE2) ? save_doubles |
| (...skipping 1394 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3623 if (ms.shift() > 0) sar(edx, ms.shift()); | 3612 if (ms.shift() > 0) sar(edx, ms.shift()); |
| 3624 mov(eax, dividend); | 3613 mov(eax, dividend); |
| 3625 shr(eax, 31); | 3614 shr(eax, 31); |
| 3626 add(edx, eax); | 3615 add(edx, eax); |
| 3627 } | 3616 } |
| 3628 | 3617 |
| 3629 | 3618 |
| 3630 } } // namespace v8::internal | 3619 } } // namespace v8::internal |
| 3631 | 3620 |
| 3632 #endif // V8_TARGET_ARCH_IA32 | 3621 #endif // V8_TARGET_ARCH_IA32 |
| OLD | NEW |