Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(226)

Side by Side Diff: src/arm64/full-codegen-arm64.cc

Issue 1168093002: [strong] Implement strong mode restrictions on property access (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebase Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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); 2094 CallLoadIC(NOT_CONTEXTUAL, language_mode());
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 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2106 __ Push(Smi::FromInt(language_mode()));
2107 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2107 } 2108 }
2108 2109
2109 2110
2110 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2111 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2111 SetSourcePosition(prop->position()); 2112 SetSourcePosition(prop->position());
2112 // Call keyed load IC. It has arguments key and receiver in x0 and x1. 2113 // Call keyed load IC. It has arguments key and receiver in x0 and x1.
2113 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2114 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code();
2114 __ Mov(LoadDescriptor::SlotRegister(), 2115 __ Mov(LoadDescriptor::SlotRegister(),
2115 SmiFromSlot(prop->PropertyFeedbackSlot())); 2116 SmiFromSlot(prop->PropertyFeedbackSlot()));
2116 CallIC(ic); 2117 CallIC(ic);
2117 } 2118 }
2118 2119
2119 2120
2120 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2121 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2121 // Stack: receiver, home_object, key. 2122 // Stack: receiver, home_object, key.
2123 __ Push(Smi::FromInt(language_mode()));
2122 SetSourcePosition(prop->position()); 2124 SetSourcePosition(prop->position());
2123 2125
2124 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2126 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2125 } 2127 }
2126 2128
2127 2129
2128 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2130 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2129 Token::Value op, 2131 Token::Value op,
2130 Expression* left_expr, 2132 Expression* left_expr,
2131 Expression* right_expr) { 2133 Expression* right_expr) {
2132 Label done, both_smis, stub_call; 2134 Label done, both_smis, stub_call;
2133 2135
2134 // Get the arguments. 2136 // Get the arguments.
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
2676 // Load the function from the receiver. 2678 // Load the function from the receiver.
2677 const Register scratch = x10; 2679 const Register scratch = x10;
2678 SuperPropertyReference* super_ref = 2680 SuperPropertyReference* super_ref =
2679 callee->AsProperty()->obj()->AsSuperPropertyReference(); 2681 callee->AsProperty()->obj()->AsSuperPropertyReference();
2680 VisitForStackValue(super_ref->home_object()); 2682 VisitForStackValue(super_ref->home_object());
2681 VisitForAccumulatorValue(super_ref->this_var()); 2683 VisitForAccumulatorValue(super_ref->this_var());
2682 __ Push(x0); 2684 __ Push(x0);
2683 __ Peek(scratch, kPointerSize); 2685 __ Peek(scratch, kPointerSize);
2684 __ Push(x0, scratch); 2686 __ Push(x0, scratch);
2685 __ Push(key->value()); 2687 __ Push(key->value());
2688 __ Push(Smi::FromInt(language_mode()));
2686 2689
2687 // Stack here: 2690 // Stack here:
2688 // - home_object 2691 // - home_object
2689 // - this (receiver) 2692 // - this (receiver)
2690 // - this (receiver) <-- LoadFromSuper will pop here and below. 2693 // - this (receiver) <-- LoadFromSuper will pop here and below.
2691 // - home_object 2694 // - home_object
2692 // - key 2695 // - language_mode
2693 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2696 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2694 2697
2695 // Replace home_object with target function. 2698 // Replace home_object with target function.
2696 __ Poke(x0, kPointerSize); 2699 __ Poke(x0, kPointerSize);
2697 2700
2698 // Stack here: 2701 // Stack here:
2699 // - target function 2702 // - target function
2700 // - this (receiver) 2703 // - this (receiver)
2701 EmitCall(expr, CallICState::METHOD); 2704 EmitCall(expr, CallICState::METHOD);
2702 } 2705 }
2703 2706
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
2736 // Load the function from the receiver. 2739 // Load the function from the receiver.
2737 const Register scratch = x10; 2740 const Register scratch = x10;
2738 SuperPropertyReference* super_ref = 2741 SuperPropertyReference* super_ref =
2739 callee->AsProperty()->obj()->AsSuperPropertyReference(); 2742 callee->AsProperty()->obj()->AsSuperPropertyReference();
2740 VisitForStackValue(super_ref->home_object()); 2743 VisitForStackValue(super_ref->home_object());
2741 VisitForAccumulatorValue(super_ref->this_var()); 2744 VisitForAccumulatorValue(super_ref->this_var());
2742 __ Push(x0); 2745 __ Push(x0);
2743 __ Peek(scratch, kPointerSize); 2746 __ Peek(scratch, kPointerSize);
2744 __ Push(x0, scratch); 2747 __ Push(x0, scratch);
2745 VisitForStackValue(prop->key()); 2748 VisitForStackValue(prop->key());
2749 __ Push(Smi::FromInt(language_mode()));
2746 2750
2747 // Stack here: 2751 // Stack here:
2748 // - home_object 2752 // - home_object
2749 // - this (receiver) 2753 // - this (receiver)
2750 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 2754 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
2751 // - home_object 2755 // - home_object
2752 // - key 2756 // - key
2753 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2757 // - language_mode
2758 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2754 2759
2755 // Replace home_object with target function. 2760 // Replace home_object with target function.
2756 __ Poke(x0, kPointerSize); 2761 __ Poke(x0, kPointerSize);
2757 2762
2758 // Stack here: 2763 // Stack here:
2759 // - target function 2764 // - target function
2760 // - this (receiver) 2765 // - this (receiver)
2761 EmitCall(expr, CallICState::METHOD); 2766 EmitCall(expr, CallICState::METHOD);
2762 } 2767 }
2763 2768
(...skipping 2427 matching lines...) Expand 10 before | Expand all | Expand 10 after
5191 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" 5196 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next"
5192 __ Peek(x3, 1 * kPointerSize); // iter 5197 __ Peek(x3, 1 * kPointerSize); // iter
5193 __ Push(load_name, x3, x0); // "next", iter, received 5198 __ Push(load_name, x3, x0); // "next", iter, received
5194 5199
5195 // result = receiver[f](arg); 5200 // result = receiver[f](arg);
5196 __ Bind(&l_call); 5201 __ Bind(&l_call);
5197 __ Peek(load_receiver, 1 * kPointerSize); 5202 __ Peek(load_receiver, 1 * kPointerSize);
5198 __ Peek(load_name, 2 * kPointerSize); 5203 __ Peek(load_name, 2 * kPointerSize);
5199 __ Mov(LoadDescriptor::SlotRegister(), 5204 __ Mov(LoadDescriptor::SlotRegister(),
5200 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); 5205 SmiFromSlot(expr->KeyedLoadFeedbackSlot()));
5201 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 5206 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
5202 CallIC(ic, TypeFeedbackId::None()); 5207 CallIC(ic, TypeFeedbackId::None());
5203 __ Mov(x1, x0); 5208 __ Mov(x1, x0);
5204 __ Poke(x1, 2 * kPointerSize); 5209 __ Poke(x1, 2 * kPointerSize);
5205 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 5210 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
5206 __ CallStub(&stub); 5211 __ CallStub(&stub);
5207 5212
5208 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 5213 __ Ldr(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
5209 __ Drop(1); // The function is still on the stack; drop it. 5214 __ Drop(1); // The function is still on the stack; drop it.
5210 5215
5211 // if (!result.done) goto l_try; 5216 // if (!result.done) goto l_try;
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
5585 } 5590 }
5586 5591
5587 return INTERRUPT; 5592 return INTERRUPT;
5588 } 5593 }
5589 5594
5590 5595
5591 } // namespace internal 5596 } // namespace internal
5592 } // namespace v8 5597 } // namespace v8
5593 5598
5594 #endif // V8_TARGET_ARCH_ARM64 5599 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm64/code-stubs-arm64.cc ('k') | src/arm64/lithium-codegen-arm64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698