| 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 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2084 | 2084 |
| 2085 | 2085 |
| 2086 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2086 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
| 2087 SetSourcePosition(prop->position()); | 2087 SetSourcePosition(prop->position()); |
| 2088 Literal* key = prop->key()->AsLiteral(); | 2088 Literal* key = prop->key()->AsLiteral(); |
| 2089 DCHECK(!prop->IsSuperAccess()); | 2089 DCHECK(!prop->IsSuperAccess()); |
| 2090 | 2090 |
| 2091 __ Mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2091 __ Mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
| 2092 __ Mov(LoadDescriptor::SlotRegister(), | 2092 __ Mov(LoadDescriptor::SlotRegister(), |
| 2093 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2093 SmiFromSlot(prop->PropertyFeedbackSlot())); |
| 2094 CallLoadIC(NOT_CONTEXTUAL, language_mode()); | 2094 CallLoadIC(NOT_CONTEXTUAL); |
| 2095 } | 2095 } |
| 2096 | 2096 |
| 2097 | 2097 |
| 2098 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2098 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
| 2099 // Stack: receiver, home_object. | 2099 // Stack: receiver, home_object. |
| 2100 SetSourcePosition(prop->position()); | 2100 SetSourcePosition(prop->position()); |
| 2101 Literal* key = prop->key()->AsLiteral(); | 2101 Literal* key = prop->key()->AsLiteral(); |
| 2102 DCHECK(!key->value()->IsSmi()); | 2102 DCHECK(!key->value()->IsSmi()); |
| 2103 DCHECK(prop->IsSuperAccess()); | 2103 DCHECK(prop->IsSuperAccess()); |
| 2104 | 2104 |
| 2105 __ Push(key->value()); | 2105 __ Push(key->value()); |
| 2106 __ Push(Smi::FromInt(language_mode())); | 2106 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
| 2107 __ CallRuntime(Runtime::kLoadFromSuper, 4); | |
| 2108 } | 2107 } |
| 2109 | 2108 |
| 2110 | 2109 |
| 2111 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2110 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
| 2112 SetSourcePosition(prop->position()); | 2111 SetSourcePosition(prop->position()); |
| 2113 // Call keyed load IC. It has arguments key and receiver in x0 and x1. | 2112 // Call keyed load IC. It has arguments key and receiver in x0 and x1. |
| 2114 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code(); | 2113 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 2115 __ Mov(LoadDescriptor::SlotRegister(), | 2114 __ Mov(LoadDescriptor::SlotRegister(), |
| 2116 SmiFromSlot(prop->PropertyFeedbackSlot())); | 2115 SmiFromSlot(prop->PropertyFeedbackSlot())); |
| 2117 CallIC(ic); | 2116 CallIC(ic); |
| 2118 } | 2117 } |
| 2119 | 2118 |
| 2120 | 2119 |
| 2121 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2120 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
| 2122 // Stack: receiver, home_object, key. | 2121 // Stack: receiver, home_object, key. |
| 2123 __ Push(Smi::FromInt(language_mode())); | |
| 2124 SetSourcePosition(prop->position()); | 2122 SetSourcePosition(prop->position()); |
| 2125 | 2123 |
| 2126 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | 2124 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2127 } | 2125 } |
| 2128 | 2126 |
| 2129 | 2127 |
| 2130 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, | 2128 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, |
| 2131 Token::Value op, | 2129 Token::Value op, |
| 2132 Expression* left_expr, | 2130 Expression* left_expr, |
| 2133 Expression* right_expr) { | 2131 Expression* right_expr) { |
| 2134 Label done, both_smis, stub_call; | 2132 Label done, both_smis, stub_call; |
| 2135 | 2133 |
| 2136 // Get the arguments. | 2134 // Get the arguments. |
| (...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2678 // Load the function from the receiver. | 2676 // Load the function from the receiver. |
| 2679 const Register scratch = x10; | 2677 const Register scratch = x10; |
| 2680 SuperPropertyReference* super_ref = | 2678 SuperPropertyReference* super_ref = |
| 2681 callee->AsProperty()->obj()->AsSuperPropertyReference(); | 2679 callee->AsProperty()->obj()->AsSuperPropertyReference(); |
| 2682 VisitForStackValue(super_ref->home_object()); | 2680 VisitForStackValue(super_ref->home_object()); |
| 2683 VisitForAccumulatorValue(super_ref->this_var()); | 2681 VisitForAccumulatorValue(super_ref->this_var()); |
| 2684 __ Push(x0); | 2682 __ Push(x0); |
| 2685 __ Peek(scratch, kPointerSize); | 2683 __ Peek(scratch, kPointerSize); |
| 2686 __ Push(x0, scratch); | 2684 __ Push(x0, scratch); |
| 2687 __ Push(key->value()); | 2685 __ Push(key->value()); |
| 2688 __ Push(Smi::FromInt(language_mode())); | |
| 2689 | 2686 |
| 2690 // Stack here: | 2687 // Stack here: |
| 2691 // - home_object | 2688 // - home_object |
| 2692 // - this (receiver) | 2689 // - this (receiver) |
| 2693 // - this (receiver) <-- LoadFromSuper will pop here and below. | 2690 // - this (receiver) <-- LoadFromSuper will pop here and below. |
| 2694 // - home_object | 2691 // - home_object |
| 2695 // - language_mode | 2692 // - key |
| 2696 __ CallRuntime(Runtime::kLoadFromSuper, 4); | 2693 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
| 2697 | 2694 |
| 2698 // Replace home_object with target function. | 2695 // Replace home_object with target function. |
| 2699 __ Poke(x0, kPointerSize); | 2696 __ Poke(x0, kPointerSize); |
| 2700 | 2697 |
| 2701 // Stack here: | 2698 // Stack here: |
| 2702 // - target function | 2699 // - target function |
| 2703 // - this (receiver) | 2700 // - this (receiver) |
| 2704 EmitCall(expr, CallICState::METHOD); | 2701 EmitCall(expr, CallICState::METHOD); |
| 2705 } | 2702 } |
| 2706 | 2703 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2739 // Load the function from the receiver. | 2736 // Load the function from the receiver. |
| 2740 const Register scratch = x10; | 2737 const Register scratch = x10; |
| 2741 SuperPropertyReference* super_ref = | 2738 SuperPropertyReference* super_ref = |
| 2742 callee->AsProperty()->obj()->AsSuperPropertyReference(); | 2739 callee->AsProperty()->obj()->AsSuperPropertyReference(); |
| 2743 VisitForStackValue(super_ref->home_object()); | 2740 VisitForStackValue(super_ref->home_object()); |
| 2744 VisitForAccumulatorValue(super_ref->this_var()); | 2741 VisitForAccumulatorValue(super_ref->this_var()); |
| 2745 __ Push(x0); | 2742 __ Push(x0); |
| 2746 __ Peek(scratch, kPointerSize); | 2743 __ Peek(scratch, kPointerSize); |
| 2747 __ Push(x0, scratch); | 2744 __ Push(x0, scratch); |
| 2748 VisitForStackValue(prop->key()); | 2745 VisitForStackValue(prop->key()); |
| 2749 __ Push(Smi::FromInt(language_mode())); | |
| 2750 | 2746 |
| 2751 // Stack here: | 2747 // Stack here: |
| 2752 // - home_object | 2748 // - home_object |
| 2753 // - this (receiver) | 2749 // - this (receiver) |
| 2754 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. | 2750 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. |
| 2755 // - home_object | 2751 // - home_object |
| 2756 // - key | 2752 // - key |
| 2757 // - language_mode | 2753 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
| 2758 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4); | |
| 2759 | 2754 |
| 2760 // Replace home_object with target function. | 2755 // Replace home_object with target function. |
| 2761 __ Poke(x0, kPointerSize); | 2756 __ Poke(x0, kPointerSize); |
| 2762 | 2757 |
| 2763 // Stack here: | 2758 // Stack here: |
| 2764 // - target function | 2759 // - target function |
| 2765 // - this (receiver) | 2760 // - this (receiver) |
| 2766 EmitCall(expr, CallICState::METHOD); | 2761 EmitCall(expr, CallICState::METHOD); |
| 2767 } | 2762 } |
| 2768 | 2763 |
| (...skipping 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5196 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 5191 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
| 5197 __ Peek(x3, 1 * kPointerSize); // iter | 5192 __ Peek(x3, 1 * kPointerSize); // iter |
| 5198 __ Push(load_name, x3, x0); // "next", iter, received | 5193 __ Push(load_name, x3, x0); // "next", iter, received |
| 5199 | 5194 |
| 5200 // result = receiver[f](arg); | 5195 // result = receiver[f](arg); |
| 5201 __ Bind(&l_call); | 5196 __ Bind(&l_call); |
| 5202 __ Peek(load_receiver, 1 * kPointerSize); | 5197 __ Peek(load_receiver, 1 * kPointerSize); |
| 5203 __ Peek(load_name, 2 * kPointerSize); | 5198 __ Peek(load_name, 2 * kPointerSize); |
| 5204 __ Mov(LoadDescriptor::SlotRegister(), | 5199 __ Mov(LoadDescriptor::SlotRegister(), |
| 5205 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); | 5200 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); |
| 5206 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code(); | 5201 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
| 5207 CallIC(ic, TypeFeedbackId::None()); | 5202 CallIC(ic, TypeFeedbackId::None()); |
| 5208 __ Mov(x1, x0); | 5203 __ Mov(x1, x0); |
| 5209 __ Poke(x1, 2 * kPointerSize); | 5204 __ Poke(x1, 2 * kPointerSize); |
| 5210 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 5205 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
| 5211 __ CallStub(&stub); | 5206 __ CallStub(&stub); |
| 5212 | 5207 |
| 5213 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 5208 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
| 5214 __ Drop(1); // The function is still on the stack; drop it. | 5209 __ Drop(1); // The function is still on the stack; drop it. |
| 5215 | 5210 |
| 5216 // if (!result.done) goto l_try; | 5211 // if (!result.done) goto l_try; |
| (...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 5590 } | 5585 } |
| 5591 | 5586 |
| 5592 return INTERRUPT; | 5587 return INTERRUPT; |
| 5593 } | 5588 } |
| 5594 | 5589 |
| 5595 | 5590 |
| 5596 } // namespace internal | 5591 } // namespace internal |
| 5597 } // namespace v8 | 5592 } // namespace v8 |
| 5598 | 5593 |
| 5599 #endif // V8_TARGET_ARCH_ARM64 | 5594 #endif // V8_TARGET_ARCH_ARM64 |
| OLD | NEW |