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

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

Issue 1199983002: [strong] Implement strong property access semantics (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Choose generic path less Created 5 years, 5 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
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_X64 7 #if V8_TARGET_ARCH_X64
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 2187 matching lines...) Expand 10 before | Expand all | Expand 10 after
2198 __ LoadRoot(load_name, Heap::knext_stringRootIndex); 2198 __ LoadRoot(load_name, Heap::knext_stringRootIndex);
2199 __ Push(load_name); // "next" 2199 __ Push(load_name); // "next"
2200 __ Push(Operand(rsp, 2 * kPointerSize)); // iter 2200 __ Push(Operand(rsp, 2 * kPointerSize)); // iter
2201 __ Push(rax); // received 2201 __ Push(rax); // received
2202 2202
2203 // result = receiver[f](arg); 2203 // result = receiver[f](arg);
2204 __ bind(&l_call); 2204 __ bind(&l_call);
2205 __ movp(load_receiver, Operand(rsp, kPointerSize)); 2205 __ movp(load_receiver, Operand(rsp, kPointerSize));
2206 __ Move(LoadDescriptor::SlotRegister(), 2206 __ Move(LoadDescriptor::SlotRegister(),
2207 SmiFromSlot(expr->KeyedLoadFeedbackSlot())); 2207 SmiFromSlot(expr->KeyedLoadFeedbackSlot()));
2208 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2208 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), SLOPPY).code();
2209 CallIC(ic, TypeFeedbackId::None()); 2209 CallIC(ic, TypeFeedbackId::None());
2210 __ movp(rdi, rax); 2210 __ movp(rdi, rax);
2211 __ movp(Operand(rsp, 2 * kPointerSize), rdi); 2211 __ movp(Operand(rsp, 2 * kPointerSize), rdi);
2212 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2212 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
2213 __ CallStub(&stub); 2213 __ CallStub(&stub);
2214 2214
2215 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset)); 2215 __ movp(rsi, Operand(rbp, StandardFrameConstants::kContextOffset));
2216 __ Drop(1); // The function is still on the stack; drop it. 2216 __ Drop(1); // The function is still on the stack; drop it.
2217 2217
2218 // if (!result.done) goto l_try; 2218 // if (!result.done) goto l_try;
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
2366 2366
2367 2367
2368 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2368 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2369 SetSourcePosition(prop->position()); 2369 SetSourcePosition(prop->position());
2370 Literal* key = prop->key()->AsLiteral(); 2370 Literal* key = prop->key()->AsLiteral();
2371 DCHECK(!prop->IsSuperAccess()); 2371 DCHECK(!prop->IsSuperAccess());
2372 2372
2373 __ Move(LoadDescriptor::NameRegister(), key->value()); 2373 __ Move(LoadDescriptor::NameRegister(), key->value());
2374 __ Move(LoadDescriptor::SlotRegister(), 2374 __ Move(LoadDescriptor::SlotRegister(),
2375 SmiFromSlot(prop->PropertyFeedbackSlot())); 2375 SmiFromSlot(prop->PropertyFeedbackSlot()));
2376 CallLoadIC(NOT_CONTEXTUAL); 2376 CallLoadIC(NOT_CONTEXTUAL, language_mode());
2377 } 2377 }
2378 2378
2379 2379
2380 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { 2380 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
2381 // Stack: receiver, home_object 2381 // Stack: receiver, home_object
2382 SetSourcePosition(prop->position()); 2382 SetSourcePosition(prop->position());
2383 Literal* key = prop->key()->AsLiteral(); 2383 Literal* key = prop->key()->AsLiteral();
2384 DCHECK(!key->value()->IsSmi()); 2384 DCHECK(!key->value()->IsSmi());
2385 DCHECK(prop->IsSuperAccess()); 2385 DCHECK(prop->IsSuperAccess());
2386 2386
2387 __ Push(key->value()); 2387 __ Push(key->value());
2388 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2388 __ Push(Smi::FromInt(language_mode()));
2389 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2389 } 2390 }
2390 2391
2391 2392
2392 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2393 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2393 SetSourcePosition(prop->position()); 2394 SetSourcePosition(prop->position());
2394 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2395 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate(), language_mode()).code();
2395 __ Move(LoadDescriptor::SlotRegister(), 2396 __ Move(LoadDescriptor::SlotRegister(),
2396 SmiFromSlot(prop->PropertyFeedbackSlot())); 2397 SmiFromSlot(prop->PropertyFeedbackSlot()));
2397 CallIC(ic); 2398 CallIC(ic);
2398 } 2399 }
2399 2400
2400 2401
2401 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2402 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2402 // Stack: receiver, home_object, key. 2403 // Stack: receiver, home_object, key.
2404 __ Push(Smi::FromInt(language_mode()));
2403 SetSourcePosition(prop->position()); 2405 SetSourcePosition(prop->position());
2404 2406
2405 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2407 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2406 } 2408 }
2407 2409
2408 2410
2409 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2411 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2410 Token::Value op, 2412 Token::Value op,
2411 Expression* left, 2413 Expression* left,
2412 Expression* right) { 2414 Expression* right) {
2413 // Do combined smi check of the operands. Left operand is on the 2415 // Do combined smi check of the operands. Left operand is on the
2414 // stack (popped into rdx). Right operand is in rax but moved into 2416 // stack (popped into rdx). Right operand is in rax but moved into
2415 // rcx to make the shifts easier. 2417 // rcx to make the shifts easier.
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
2884 Literal* key = prop->key()->AsLiteral(); 2886 Literal* key = prop->key()->AsLiteral();
2885 DCHECK(!key->value()->IsSmi()); 2887 DCHECK(!key->value()->IsSmi());
2886 // Load the function from the receiver. 2888 // Load the function from the receiver.
2887 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2889 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2888 VisitForStackValue(super_ref->home_object()); 2890 VisitForStackValue(super_ref->home_object());
2889 VisitForAccumulatorValue(super_ref->this_var()); 2891 VisitForAccumulatorValue(super_ref->this_var());
2890 __ Push(rax); 2892 __ Push(rax);
2891 __ Push(rax); 2893 __ Push(rax);
2892 __ Push(Operand(rsp, kPointerSize * 2)); 2894 __ Push(Operand(rsp, kPointerSize * 2));
2893 __ Push(key->value()); 2895 __ Push(key->value());
2896 __ Push(Smi::FromInt(language_mode()));
2894 2897
2895 // Stack here: 2898 // Stack here:
2896 // - home_object 2899 // - home_object
2897 // - this (receiver) 2900 // - this (receiver)
2898 // - this (receiver) <-- LoadFromSuper will pop here and below. 2901 // - this (receiver) <-- LoadFromSuper will pop here and below.
2899 // - home_object 2902 // - home_object
2900 // - key 2903 // - key
2901 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2904 // - language_mode
2905 __ CallRuntime(Runtime::kLoadFromSuper, 4);
2902 2906
2903 // Replace home_object with target function. 2907 // Replace home_object with target function.
2904 __ movp(Operand(rsp, kPointerSize), rax); 2908 __ movp(Operand(rsp, kPointerSize), rax);
2905 2909
2906 // Stack here: 2910 // Stack here:
2907 // - target function 2911 // - target function
2908 // - this (receiver) 2912 // - this (receiver)
2909 EmitCall(expr, CallICState::METHOD); 2913 EmitCall(expr, CallICState::METHOD);
2910 } 2914 }
2911 2915
(...skipping 29 matching lines...) Expand all
2941 2945
2942 SetSourcePosition(prop->position()); 2946 SetSourcePosition(prop->position());
2943 // Load the function from the receiver. 2947 // Load the function from the receiver.
2944 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference(); 2948 SuperPropertyReference* super_ref = prop->obj()->AsSuperPropertyReference();
2945 VisitForStackValue(super_ref->home_object()); 2949 VisitForStackValue(super_ref->home_object());
2946 VisitForAccumulatorValue(super_ref->this_var()); 2950 VisitForAccumulatorValue(super_ref->this_var());
2947 __ Push(rax); 2951 __ Push(rax);
2948 __ Push(rax); 2952 __ Push(rax);
2949 __ Push(Operand(rsp, kPointerSize * 2)); 2953 __ Push(Operand(rsp, kPointerSize * 2));
2950 VisitForStackValue(prop->key()); 2954 VisitForStackValue(prop->key());
2955 __ Push(Smi::FromInt(language_mode()));
2951 2956
2952 // Stack here: 2957 // Stack here:
2953 // - home_object 2958 // - home_object
2954 // - this (receiver) 2959 // - this (receiver)
2955 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below. 2960 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
2956 // - home_object 2961 // - home_object
2957 // - key 2962 // - key
2958 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2963 // - language_mode
2964 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 4);
2959 2965
2960 // Replace home_object with target function. 2966 // Replace home_object with target function.
2961 __ movp(Operand(rsp, kPointerSize), rax); 2967 __ movp(Operand(rsp, kPointerSize), rax);
2962 2968
2963 // Stack here: 2969 // Stack here:
2964 // - target function 2970 // - target function
2965 // - this (receiver) 2971 // - this (receiver)
2966 EmitCall(expr, CallICState::METHOD); 2972 EmitCall(expr, CallICState::METHOD);
2967 } 2973 }
2968 2974
(...skipping 2546 matching lines...) Expand 10 before | Expand all | Expand 10 after
5515 Assembler::target_address_at(call_target_address, 5521 Assembler::target_address_at(call_target_address,
5516 unoptimized_code)); 5522 unoptimized_code));
5517 return OSR_AFTER_STACK_CHECK; 5523 return OSR_AFTER_STACK_CHECK;
5518 } 5524 }
5519 5525
5520 5526
5521 } // namespace internal 5527 } // namespace internal
5522 } // namespace v8 5528 } // namespace v8
5523 5529
5524 #endif // V8_TARGET_ARCH_X64 5530 #endif // V8_TARGET_ARCH_X64
OLDNEW
« src/objects.cc ('K') | « src/x64/code-stubs-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698