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_ARM64 | 7 #if V8_TARGET_ARCH_ARM64 |
8 | 8 |
9 #include "src/code-factory.h" | 9 #include "src/code-factory.h" |
10 #include "src/code-stubs.h" | 10 #include "src/code-stubs.h" |
(...skipping 2077 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2088 | 2088 |
2089 | 2089 |
2090 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2090 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2091 SetSourcePosition(prop->position()); | 2091 SetSourcePosition(prop->position()); |
2092 Literal* key = prop->key()->AsLiteral(); | 2092 Literal* key = prop->key()->AsLiteral(); |
2093 DCHECK(!prop->IsSuperAccess()); | 2093 DCHECK(!prop->IsSuperAccess()); |
2094 | 2094 |
2095 __ Mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2095 __ Mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
2096 __ Mov(LoadDescriptor::SlotRegister(), | 2096 __ Mov(LoadDescriptor::SlotRegister(), |
2097 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2097 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2098 CallLoadIC(NOT_CONTEXTUAL); | 2098 CallLoadIC(NOT_CONTEXTUAL, language_mode()); |
2099 } | 2099 } |
2100 | 2100 |
2101 | 2101 |
2102 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2102 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2103 // Stack: receiver, home_object. | 2103 // Stack: receiver, home_object. |
2104 SetSourcePosition(prop->position()); | 2104 SetSourcePosition(prop->position()); |
2105 Literal* key = prop->key()->AsLiteral(); | 2105 Literal* key = prop->key()->AsLiteral(); |
2106 DCHECK(!key->value()->IsSmi()); | 2106 DCHECK(!key->value()->IsSmi()); |
2107 DCHECK(prop->IsSuperAccess()); | 2107 DCHECK(prop->IsSuperAccess()); |
2108 | 2108 |
2109 __ Push(key->value()); | 2109 __ Push(key->value()); |
2110 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2110 __ Push(Smi::FromInt(language_mode())); |
| 2111 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2111 } | 2112 } |
2112 | 2113 |
2113 | 2114 |
2114 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2115 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2115 SetSourcePosition(prop->position()); | 2116 SetSourcePosition(prop->position()); |
2116 // Call keyed load IC. It has arguments key and receiver in x0 and x1. | 2117 // Call keyed load IC. It has arguments key and receiver in x0 and x1. |
2117 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2118 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); |
2118 __ Mov(LoadDescriptor::SlotRegister(), | 2119 __ Mov(LoadDescriptor::SlotRegister(), |
2119 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2120 SmiFromSlot(prop->PropertyFeedbackSlot())); |
2120 CallIC(ic); | 2121 CallIC(ic); |
2121 } | 2122 } |
2122 | 2123 |
2123 | 2124 |
2124 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2125 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2125 // Stack: receiver, home_object, key. | 2126 // Stack: receiver, home_object, key. |
| 2127 __ Push(Smi::FromInt(language_mode())); |
2126 SetSourcePosition(prop->position()); | 2128 SetSourcePosition(prop->position()); |
2127 | 2129 |
2128 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2130 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2129 } | 2131 } |
2130 | 2132 |
2131 | 2133 |
2132 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2134 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
2133 Token::Value op, | 2135 Token::Value op, |
2134 Expression* left_expr, | 2136 Expression* left_expr, |
2135 Expression* right_expr) { | 2137 Expression* right_expr) { |
2136 Label done, both_smis, stub_call; | 2138 Label done, both_smis, stub_call; |
2137 | 2139 |
2138 // Get the arguments. | 2140 // Get the arguments. |
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2680 // Load the function from the receiver. | 2682 // Load the function from the receiver. |
2681 const Register scratch = x10; | 2683 const Register scratch = x10; |
2682 SuperPropertyReference* super_ref = | 2684 SuperPropertyReference* super_ref = |
2683 callee->AsProperty()->obj()->AsSuperPropertyReference(); | 2685 callee->AsProperty()->obj()->AsSuperPropertyReference(); |
2684 VisitForStackValue(super_ref->home_object()); | 2686 VisitForStackValue(super_ref->home_object()); |
2685 VisitForAccumulatorValue(super_ref->this_var()); | 2687 VisitForAccumulatorValue(super_ref->this_var()); |
2686 __ Push(x0); | 2688 __ Push(x0); |
2687 __ Peek(scratch, kPointerSize); | 2689 __ Peek(scratch, kPointerSize); |
2688 __ Push(x0, scratch); | 2690 __ Push(x0, scratch); |
2689 __ Push(key->value()); | 2691 __ Push(key->value()); |
| 2692 __ Push(Smi::FromInt(language_mode())); |
2690 | 2693 |
2691 // Stack here: | 2694 // Stack here: |
2692 // - home_object | 2695 // - home_object |
2693 // - this (receiver) | 2696 // - this (receiver) |
2694 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2697 // - this (receiver) <-- LoadFromSuper will pop here and below. |
2695 // - home_object | 2698 // - home_object |
2696 // - key | 2699 // - language_mode |
2697 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2700 __ CallRuntime(Runtime::kLoadFromSuper, 4); |
2698 | 2701 |
2699 // Replace home_object with target function. | 2702 // Replace home_object with target function. |
2700 __ Poke(x0, kPointerSize); | 2703 __ Poke(x0, kPointerSize); |
2701 | 2704 |
2702 // Stack here: | 2705 // Stack here: |
2703 // - target function | 2706 // - target function |
2704 // - this (receiver) | 2707 // - this (receiver) |
2705 EmitCall(expr, CallICState::METHOD); | 2708 EmitCall(expr, CallICState::METHOD); |
2706 } | 2709 } |
2707 | 2710 |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2740 // Load the function from the receiver. | 2743 // Load the function from the receiver. |
2741 const Register scratch = x10; | 2744 const Register scratch = x10; |
2742 SuperPropertyReference* super_ref = | 2745 SuperPropertyReference* super_ref = |
2743 callee->AsProperty()->obj()->AsSuperPropertyReference(); | 2746 callee->AsProperty()->obj()->AsSuperPropertyReference(); |
2744 VisitForStackValue(super_ref->home_object()); | 2747 VisitForStackValue(super_ref->home_object()); |
2745 VisitForAccumulatorValue(super_ref->this_var()); | 2748 VisitForAccumulatorValue(super_ref->this_var()); |
2746 __ Push(x0); | 2749 __ Push(x0); |
2747 __ Peek(scratch, kPointerSize); | 2750 __ Peek(scratch, kPointerSize); |
2748 __ Push(x0, scratch); | 2751 __ Push(x0, scratch); |
2749 VisitForStackValue(prop->key()); | 2752 VisitForStackValue(prop->key()); |
| 2753 __ Push(Smi::FromInt(language_mode())); |
2750 | 2754 |
2751 // Stack here: | 2755 // Stack here: |
2752 // - home_object | 2756 // - home_object |
2753 // - this (receiver) | 2757 // - this (receiver) |
2754 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2758 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
2755 // - home_object | 2759 // - home_object |
2756 // - key | 2760 // - key |
2757 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2761 // - language_mode |
| 2762 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); |
2758 | 2763 |
2759 // Replace home_object with target function. | 2764 // Replace home_object with target function. |
2760 __ Poke(x0, kPointerSize); | 2765 __ Poke(x0, kPointerSize); |
2761 | 2766 |
2762 // Stack here: | 2767 // Stack here: |
2763 // - target function | 2768 // - target function |
2764 // - this (receiver) | 2769 // - this (receiver) |
2765 EmitCall(expr, CallICState::METHOD); | 2770 EmitCall(expr, CallICState::METHOD); |
2766 } | 2771 } |
2767 | 2772 |
(...skipping 2409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5177 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 5182 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
5178 __ Peek(x3, 1 * kPointerSize); // iter | 5183 __ Peek(x3, 1 * kPointerSize); // iter |
5179 __ Push(load_name, x3, x0); // "next", iter, received | 5184 __ Push(load_name, x3, x0); // "next", iter, received |
5180 | 5185 |
5181 // result = receiver[f](arg); | 5186 // result = receiver[f](arg); |
5182 __ Bind(&l_call); | 5187 __ Bind(&l_call); |
5183 __ Peek(load_receiver, 1 * kPointerSize); | 5188 __ Peek(load_receiver, 1 * kPointerSize); |
5184 __ Peek(load_name, 2 * kPointerSize); | 5189 __ Peek(load_name, 2 * kPointerSize); |
5185 __ Mov(LoadDescriptor::SlotRegister(), | 5190 __ Mov(LoadDescriptor::SlotRegister(), |
5186 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); | 5191 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
5187 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 5192 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); |
5188 CallIC(ic, TypeFeedbackId::None()); | 5193 CallIC(ic, TypeFeedbackId::None()); |
5189 __ Mov(x1, x0); | 5194 __ Mov(x1, x0); |
5190 __ Poke(x1, 2 * kPointerSize); | 5195 __ Poke(x1, 2 * kPointerSize); |
5191 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 5196 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
5192 __ CallStub(&stub); | 5197 __ CallStub(&stub); |
5193 | 5198 |
5194 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5199 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
5195 __ Drop(1); // The function is still on the stack; drop it. | 5200 __ Drop(1); // The function is still on the stack; drop it. |
5196 | 5201 |
5197 // if (!result.done) goto l_try; | 5202 // if (!result.done) goto l_try; |
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5571 } | 5576 } |
5572 | 5577 |
5573 return INTERRUPT; | 5578 return INTERRUPT; |
5574 } | 5579 } |
5575 | 5580 |
5576 | 5581 |
5577 } // namespace internal | 5582 } // namespace internal |
5578 } // namespace v8 | 5583 } // namespace v8 |
5579 | 5584 |
5580 #endif // V8_TARGET_ARCH_ARM64 | 5585 #endif // V8_TARGET_ARCH_ARM64 |
OLD | NEW |