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 #if V8_TARGET_ARCH_X64 | 5 #if V8_TARGET_ARCH_X64 |
6 | 6 |
7 #include "src/full-codegen/full-codegen.h" | 7 #include "src/full-codegen/full-codegen.h" |
8 #include "src/ast/compile-time-value.h" | 8 #include "src/ast/compile-time-value.h" |
9 #include "src/ast/scopes.h" | 9 #include "src/ast/scopes.h" |
10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
(...skipping 2693 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2704 __ movp(rdi, Operand(rsp, (argc + 1) * kPointerSize)); | 2704 __ movp(rdi, Operand(rsp, (argc + 1) * kPointerSize)); |
2705 // Call the target. | 2705 // Call the target. |
2706 __ Set(rax, argc); | 2706 __ Set(rax, argc); |
2707 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); | 2707 __ Call(isolate()->builtins()->Call(), RelocInfo::CODE_TARGET); |
2708 OperandStackDepthDecrement(argc + 1); | 2708 OperandStackDepthDecrement(argc + 1); |
2709 RestoreContext(); | 2709 RestoreContext(); |
2710 // Discard the function left on TOS. | 2710 // Discard the function left on TOS. |
2711 context()->DropAndPlug(1, rax); | 2711 context()->DropAndPlug(1, rax); |
2712 } | 2712 } |
2713 | 2713 |
2714 | |
2715 void FullCodeGenerator::EmitHasCachedArrayIndex(CallRuntime* expr) { | |
2716 ZoneList<Expression*>* args = expr->arguments(); | |
2717 DCHECK(args->length() == 1); | |
2718 | |
2719 VisitForAccumulatorValue(args->at(0)); | |
2720 | |
2721 Label materialize_true, materialize_false; | |
2722 Label* if_true = NULL; | |
2723 Label* if_false = NULL; | |
2724 Label* fall_through = NULL; | |
2725 context()->PrepareTest(&materialize_true, &materialize_false, | |
2726 &if_true, &if_false, &fall_through); | |
2727 | |
2728 __ testl(FieldOperand(rax, String::kHashFieldOffset), | |
2729 Immediate(String::kContainsCachedArrayIndexMask)); | |
2730 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); | |
2731 __ j(zero, if_true); | |
2732 __ jmp(if_false); | |
2733 | |
2734 context()->Plug(if_true, if_false); | |
2735 } | |
2736 | |
2737 | |
2738 void FullCodeGenerator::EmitGetCachedArrayIndex(CallRuntime* expr) { | |
2739 ZoneList<Expression*>* args = expr->arguments(); | |
2740 DCHECK(args->length() == 1); | |
2741 VisitForAccumulatorValue(args->at(0)); | |
2742 | |
2743 __ AssertString(rax); | |
2744 | |
2745 __ movl(rax, FieldOperand(rax, String::kHashFieldOffset)); | |
2746 DCHECK(String::kHashShift >= kSmiTagSize); | |
2747 __ IndexFromHash(rax, rax); | |
2748 | |
2749 context()->Plug(rax); | |
2750 } | |
2751 | |
2752 | |
2753 void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) { | 2714 void FullCodeGenerator::EmitGetSuperConstructor(CallRuntime* expr) { |
2754 ZoneList<Expression*>* args = expr->arguments(); | 2715 ZoneList<Expression*>* args = expr->arguments(); |
2755 DCHECK_EQ(1, args->length()); | 2716 DCHECK_EQ(1, args->length()); |
2756 VisitForAccumulatorValue(args->at(0)); | 2717 VisitForAccumulatorValue(args->at(0)); |
2757 __ AssertFunction(rax); | 2718 __ AssertFunction(rax); |
2758 __ movp(rax, FieldOperand(rax, HeapObject::kMapOffset)); | 2719 __ movp(rax, FieldOperand(rax, HeapObject::kMapOffset)); |
2759 __ movp(rax, FieldOperand(rax, Map::kPrototypeOffset)); | 2720 __ movp(rax, FieldOperand(rax, Map::kPrototypeOffset)); |
2760 context()->Plug(rax); | 2721 context()->Plug(rax); |
2761 } | 2722 } |
2762 | 2723 |
(...skipping 785 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3548 DCHECK_EQ( | 3509 DCHECK_EQ( |
3549 isolate->builtins()->OnStackReplacement()->entry(), | 3510 isolate->builtins()->OnStackReplacement()->entry(), |
3550 Assembler::target_address_at(call_target_address, unoptimized_code)); | 3511 Assembler::target_address_at(call_target_address, unoptimized_code)); |
3551 return ON_STACK_REPLACEMENT; | 3512 return ON_STACK_REPLACEMENT; |
3552 } | 3513 } |
3553 | 3514 |
3554 } // namespace internal | 3515 } // namespace internal |
3555 } // namespace v8 | 3516 } // namespace v8 |
3556 | 3517 |
3557 #endif // V8_TARGET_ARCH_X64 | 3518 #endif // V8_TARGET_ARCH_X64 |
OLD | NEW |