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

Side by Side Diff: src/mips/full-codegen-mips.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/mips/code-stubs-mips.cc ('k') | src/mips/lithium-codegen-mips.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 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 #include "src/v8.h" 5 #include "src/v8.h"
6 6
7 #if V8_TARGET_ARCH_MIPS 7 #if V8_TARGET_ARCH_MIPS
8 8
9 // Note on Mips implementation: 9 // Note on Mips implementation:
10 // 10 //
(...skipping 2211 matching lines...) Expand 10 before | Expand all | Expand 10 after
2222 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" 2222 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next"
2223 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter 2223 __ lw(a3, MemOperand(sp, 1 * kPointerSize)); // iter
2224 __ Push(load_name, a3, a0); // "next", iter, received 2224 __ Push(load_name, a3, a0); // "next", iter, received
2225 2225
2226 // result = receiver[f](arg); 2226 // result = receiver[f](arg);
2227 __ bind(&l_call); 2227 __ bind(&l_call);
2228 __ lw(load_receiver, MemOperand(sp, kPointerSize)); 2228 __ lw(load_receiver, MemOperand(sp, kPointerSize));
2229 __ lw(load_name, MemOperand(sp, 2 * kPointerSize)); 2229 __ lw(load_name, MemOperand(sp, 2 * kPointerSize));
2230 __ li(LoadDescriptor::SlotRegister(), 2230 __ li(LoadDescriptor::SlotRegister(),
2231 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2231 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2232 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2232 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2233 CallIC(ic, TypeFeedbackId::None()); 2233 CallIC(ic, TypeFeedbackId::None());
2234 __ mov(a0, v0); 2234 __ mov(a0, v0);
2235 __ mov(a1, a0); 2235 __ mov(a1, a0);
2236 __ sw(a1, MemOperand(sp, 2 * kPointerSize)); 2236 __ sw(a1, MemOperand(sp, 2 * kPointerSize));
2237 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2237 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
2238 __ CallStub(&stub); 2238 __ CallStub(&stub);
2239 2239
2240 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2240 __ lw(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2241 __ Drop(1); // The function is still on the stack; drop it. 2241 __ Drop(1); // The function is still on the stack; drop it.
2242 2242
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2393 2393
2394 2394
2395 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2395 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2396 SetSourcePosition(prop->position()); 2396 SetSourcePosition(prop->position());
2397 Literal* key = prop->key()->AsLiteral(); 2397 Literal* key = prop->key()->AsLiteral();
2398 DCHECK(!prop->IsSuperAccess()); 2398 DCHECK(!prop->IsSuperAccess());
2399 2399
2400 __ li(LoadDescriptor::NameRegister(), Operand(key->value())); 2400 __ li(LoadDescriptor::NameRegister(), Operand(key->value()));
2401 __ li(LoadDescriptor::SlotRegister(), 2401 __ li(LoadDescriptor::SlotRegister(),
2402 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2402 Operand(SmiFromSlot(prop->PropertyFeedbackSlot())));
2403 CallLoadIC(NOT_CONTEXTUAL); 2403 CallLoadIC(NOT_CONTEXTUAL, language_mode());
2404 } 2404 }
2405 2405
2406 2406
2407 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { 2407 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
2408 // Stack: receiver, home_object. 2408 // Stack: receiver, home_object.
2409 SetSourcePosition(prop->position()); 2409 SetSourcePosition(prop->position());
2410 Literal* key = prop->key()->AsLiteral(); 2410 Literal* key = prop->key()->AsLiteral();
2411 DCHECK(!key->value()->IsSmi()); 2411 DCHECK(!key->value()->IsSmi());
2412 DCHECK(prop->IsSuperAccess()); 2412 DCHECK(prop->IsSuperAccess());
2413 2413
2414 __ Push(key->value()); 2414 __ Push(key->value());
2415 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2415 __ Push(Smi::FromInt(language_mode()));
2416 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2416 } 2417 }
2417 2418
2418 2419
2419 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2420 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2420 SetSourcePosition(prop->position()); 2421 SetSourcePosition(prop->position());
2421 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2422 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code();
2422 __ li(LoadDescriptor::SlotRegister(), 2423 __ li(LoadDescriptor::SlotRegister(),
2423 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2424 Operand(SmiFromSlot(prop->PropertyFeedbackSlot())));
2424 CallIC(ic); 2425 CallIC(ic);
2425 } 2426 }
2426 2427
2427 2428
2428 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2429 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2429 // Stack: receiver, home_object, key. 2430 // Stack: receiver, home_object, key.
2431 __ Push(Smi::FromInt(language_mode()));
2430 SetSourcePosition(prop->position()); 2432 SetSourcePosition(prop->position());
2431 2433
2432 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2434 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2433 } 2435 }
2434 2436
2435 2437
2436 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2438 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2437 Token::Value op, 2439 Token::Value op,
2438 Expression* left_expr, 2440 Expression* left_expr,
2439 Expression* right_expr) { 2441 Expression* right_expr) {
2440 Label done, smi_case, stub_call; 2442 Label done, smi_case, stub_call;
2441 2443
2442 Register scratch1 = a2; 2444 Register scratch1 = a2;
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
2968 Literal* key = prop->key()->AsLiteral(); 2970 Literal* key = prop->key()->AsLiteral();
2969 DCHECK(!key->value()->IsSmi()); 2971 DCHECK(!key->value()->IsSmi());
2970 // Load the function from the receiver. 2972 // Load the function from the receiver.
2971 const Register scratch = a1; 2973 const Register scratch = a1;
2972 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2974 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2973 VisitForAccumulatorValue(super_ref->home_object()); 2975 VisitForAccumulatorValue(super_ref->home_object());
2974 __ mov(scratch, v0); 2976 __ mov(scratch, v0);
2975 VisitForAccumulatorValue(super_ref->this_var()); 2977 VisitForAccumulatorValue(super_ref->this_var());
2976 __ Push(scratch, v0, v0, scratch); 2978 __ Push(scratch, v0, v0, scratch);
2977 __ Push(key->value()); 2979 __ Push(key->value());
2980 __ Push(Smi::FromInt(language_mode()));
2978 2981
2979 // Stack here: 2982 // Stack here:
2980 // - home_object 2983 // - home_object
2981 // - this (receiver) 2984 // - this (receiver)
2982 // - this (receiver) <-- LoadFromSuper will pop here and below. 2985 // - this (receiver) <-- LoadFromSuper will pop here and below.
2983 // - home_object 2986 // - home_object
2984 // - key 2987 // - key
2985 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2988 // - language_mode
2989 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2986 2990
2987 // Replace home_object with target function. 2991 // Replace home_object with target function.
2988 __ sw(v0, MemOperand(sp, kPointerSize)); 2992 __ sw(v0, MemOperand(sp, kPointerSize));
2989 2993
2990 // Stack here: 2994 // Stack here:
2991 // - target function 2995 // - target function
2992 // - this (receiver) 2996 // - this (receiver)
2993 EmitCall(expr, CallICState::METHOD); 2997 EmitCall(expr, CallICState::METHOD);
2994 } 2998 }
2995 2999
(...skipping 30 matching lines...) Expand all
3026 3030
3027 SetSourcePosition(prop->position()); 3031 SetSourcePosition(prop->position());
3028 // Load the function from the receiver. 3032 // Load the function from the receiver.
3029 const Register scratch = a1; 3033 const Register scratch = a1;
3030 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 3034 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
3031 VisitForAccumulatorValue(super_ref->home_object()); 3035 VisitForAccumulatorValue(super_ref->home_object());
3032 __ Move(scratch, v0); 3036 __ Move(scratch, v0);
3033 VisitForAccumulatorValue(super_ref->this_var()); 3037 VisitForAccumulatorValue(super_ref->this_var());
3034 __ Push(scratch, v0, v0, scratch); 3038 __ Push(scratch, v0, v0, scratch);
3035 VisitForStackValue(prop->key()); 3039 VisitForStackValue(prop->key());
3040 __ Push(Smi::FromInt(language_mode()));
3036 3041
3037 // Stack here: 3042 // Stack here:
3038 // - home_object 3043 // - home_object
3039 // - this (receiver) 3044 // - this (receiver)
3040 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 3045 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
3041 // - home_object 3046 // - home_object
3042 // - key 3047 // - key
3043 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 3048 // - language_mode
3049 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
3044 3050
3045 // Replace home_object with target function. 3051 // Replace home_object with target function.
3046 __ sw(v0, MemOperand(sp, kPointerSize)); 3052 __ sw(v0, MemOperand(sp, kPointerSize));
3047 3053
3048 // Stack here: 3054 // Stack here:
3049 // - target function 3055 // - target function
3050 // - this (receiver) 3056 // - this (receiver)
3051 EmitCall(expr, CallICState::METHOD); 3057 EmitCall(expr, CallICState::METHOD);
3052 } 3058 }
3053 3059
(...skipping 2506 matching lines...) Expand 10 before | Expand all | Expand 10 after
5560 reinterpret_cast<uint32_t>( 5566 reinterpret_cast<uint32_t>(
5561 isolate->builtins()->OsrAfterStackCheck()->entry())); 5567 isolate->builtins()->OsrAfterStackCheck()->entry()));
5562 return OSR_AFTER_STACK_CHECK; 5568 return OSR_AFTER_STACK_CHECK;
5563 } 5569 }
5564 5570
5565 5571
5566 } // namespace internal 5572 } // namespace internal
5567 } // namespace v8 5573 } // namespace v8
5568 5574
5569 #endif // V8_TARGET_ARCH_MIPS 5575 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/code-stubs-mips.cc ('k') | src/mips/lithium-codegen-mips.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698