OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 "src/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #if V8_TARGET_ARCH_X64 | 7 #if V8_TARGET_ARCH_X64 |
8 | 8 |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2371 int argc = state_.arg_count(); | 2371 int argc = state_.arg_count(); |
2372 ParameterCount actual(argc); | 2372 ParameterCount actual(argc); |
2373 | 2373 |
2374 EmitLoadTypeFeedbackVector(masm, rbx); | 2374 EmitLoadTypeFeedbackVector(masm, rbx); |
2375 __ SmiToInteger32(rdx, rdx); | 2375 __ SmiToInteger32(rdx, rdx); |
2376 | 2376 |
2377 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); | 2377 __ LoadGlobalFunction(Context::ARRAY_FUNCTION_INDEX, rcx); |
2378 __ cmpq(rdi, rcx); | 2378 __ cmpq(rdi, rcx); |
2379 __ j(not_equal, &miss); | 2379 __ j(not_equal, &miss); |
2380 | 2380 |
2381 __ movq(rax, Immediate(arg_count())); | 2381 __ movp(rax, Immediate(arg_count())); |
2382 __ movp(rbx, FieldOperand(rbx, rdx, times_pointer_size, | 2382 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, |
2383 FixedArray::kHeaderSize)); | 2383 FixedArray::kHeaderSize)); |
| 2384 // Verify that ecx contains an AllocationSite |
| 2385 Factory* factory = masm->isolate()->factory(); |
| 2386 __ Cmp(FieldOperand(rcx, HeapObject::kMapOffset), |
| 2387 factory->allocation_site_map()); |
| 2388 __ j(not_equal, &miss); |
2384 | 2389 |
2385 // Verify that ecx contains an AllocationSite | 2390 __ movp(rbx, rcx); |
2386 __ AssertUndefinedOrAllocationSite(rbx); | |
2387 ArrayConstructorStub stub(masm->isolate(), arg_count()); | 2391 ArrayConstructorStub stub(masm->isolate(), arg_count()); |
2388 __ TailCallStub(&stub); | 2392 __ TailCallStub(&stub); |
2389 | 2393 |
2390 __ bind(&miss); | 2394 __ bind(&miss); |
2391 GenerateMiss(masm, IC::kCallIC_Customization_Miss); | 2395 GenerateMiss(masm, IC::kCallIC_Customization_Miss); |
2392 | 2396 |
2393 // The slow case, we need this no matter what to complete a call after a miss. | 2397 // The slow case, we need this no matter what to complete a call after a miss. |
2394 CallFunctionNoFeedback(masm, | 2398 CallFunctionNoFeedback(masm, |
2395 arg_count(), | 2399 arg_count(), |
2396 true, | 2400 true, |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2450 Label miss; | 2454 Label miss; |
2451 | 2455 |
2452 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, | 2456 __ movp(rcx, FieldOperand(rbx, rdx, times_pointer_size, |
2453 FixedArray::kHeaderSize)); | 2457 FixedArray::kHeaderSize)); |
2454 __ Cmp(rcx, TypeFeedbackInfo::MegamorphicSentinel(isolate)); | 2458 __ Cmp(rcx, TypeFeedbackInfo::MegamorphicSentinel(isolate)); |
2455 __ j(equal, &slow_start); | 2459 __ j(equal, &slow_start); |
2456 __ Cmp(rcx, TypeFeedbackInfo::UninitializedSentinel(isolate)); | 2460 __ Cmp(rcx, TypeFeedbackInfo::UninitializedSentinel(isolate)); |
2457 __ j(equal, &miss); | 2461 __ j(equal, &miss); |
2458 | 2462 |
2459 if (!FLAG_trace_ic) { | 2463 if (!FLAG_trace_ic) { |
2460 // We are going megamorphic, and we don't want to visit the runtime. | 2464 // We are going megamorphic. If the feedback is a JSFunction, it is fine |
| 2465 // to handle it here. More complex cases are dealt with in the runtime. |
| 2466 __ AssertNotSmi(rcx); |
| 2467 __ CmpObjectType(rcx, JS_FUNCTION_TYPE, rcx); |
| 2468 __ j(not_equal, &miss); |
2461 __ Move(FieldOperand(rbx, rdx, times_pointer_size, | 2469 __ Move(FieldOperand(rbx, rdx, times_pointer_size, |
2462 FixedArray::kHeaderSize), | 2470 FixedArray::kHeaderSize), |
2463 TypeFeedbackInfo::MegamorphicSentinel(isolate)); | 2471 TypeFeedbackInfo::MegamorphicSentinel(isolate)); |
2464 __ jmp(&slow_start); | 2472 __ jmp(&slow_start); |
2465 } | 2473 } |
2466 | 2474 |
2467 // We are here because tracing is on or we are going monomorphic. | 2475 // We are here because tracing is on or we are going monomorphic. |
2468 __ bind(&miss); | 2476 __ bind(&miss); |
2469 GenerateMiss(masm, IC::kCallIC_Miss); | 2477 GenerateMiss(masm, IC::kCallIC_Miss); |
2470 | 2478 |
(...skipping 2575 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5046 return_value_operand, | 5054 return_value_operand, |
5047 NULL); | 5055 NULL); |
5048 } | 5056 } |
5049 | 5057 |
5050 | 5058 |
5051 #undef __ | 5059 #undef __ |
5052 | 5060 |
5053 } } // namespace v8::internal | 5061 } } // namespace v8::internal |
5054 | 5062 |
5055 #endif // V8_TARGET_ARCH_X64 | 5063 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |