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

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

Issue 622523004: Support for super keyed loads where key is a name. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: CR feedback Created 6 years, 2 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 | Annotate | Revision Log
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 2014 matching lines...) Expand 10 before | Expand all | Expand 10 after
2025 if (FLAG_vector_ics) { 2025 if (FLAG_vector_ics) {
2026 __ Mov(VectorLoadICDescriptor::SlotRegister(), 2026 __ Mov(VectorLoadICDescriptor::SlotRegister(),
2027 Smi::FromInt(prop->PropertyFeedbackSlot())); 2027 Smi::FromInt(prop->PropertyFeedbackSlot()));
2028 CallIC(ic); 2028 CallIC(ic);
2029 } else { 2029 } else {
2030 CallIC(ic, prop->PropertyFeedbackId()); 2030 CallIC(ic, prop->PropertyFeedbackId());
2031 } 2031 }
2032 } 2032 }
2033 2033
2034 2034
2035 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2036 // Stack: receiver, home_object, key.
2037 SetSourcePosition(prop->position());
2038
2039 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
2040 }
2041
2042
2035 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr, 2043 void FullCodeGenerator::EmitInlineSmiBinaryOp(BinaryOperation* expr,
2036 Token::Value op, 2044 Token::Value op,
2037 OverwriteMode mode, 2045 OverwriteMode mode,
2038 Expression* left_expr, 2046 Expression* left_expr,
2039 Expression* right_expr) { 2047 Expression* right_expr) {
2040 Label done, both_smis, stub_call; 2048 Label done, both_smis, stub_call;
2041 2049
2042 // Get the arguments. 2050 // Get the arguments.
2043 Register left = x1; 2051 Register left = x1;
2044 Register right = x0; 2052 Register right = x0;
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
2343 EmitNamedPropertyLoad(expr); 2351 EmitNamedPropertyLoad(expr);
2344 } else { 2352 } else {
2345 VisitForStackValue(expr->obj()->AsSuperReference()->this_var()); 2353 VisitForStackValue(expr->obj()->AsSuperReference()->this_var());
2346 EmitLoadHomeObject(expr->obj()->AsSuperReference()); 2354 EmitLoadHomeObject(expr->obj()->AsSuperReference());
2347 __ Push(result_register()); 2355 __ Push(result_register());
2348 EmitNamedSuperPropertyLoad(expr); 2356 EmitNamedSuperPropertyLoad(expr);
2349 } 2357 }
2350 PrepareForBailoutForId(expr->LoadId(), TOS_REG); 2358 PrepareForBailoutForId(expr->LoadId(), TOS_REG);
2351 context()->Plug(x0); 2359 context()->Plug(x0);
2352 } else { 2360 } else {
2353 VisitForStackValue(expr->obj()); 2361 if (!expr->IsSuperAccess()) {
2354 VisitForAccumulatorValue(expr->key()); 2362 VisitForStackValue(expr->obj());
2355 __ Move(LoadDescriptor::NameRegister(), x0); 2363 VisitForAccumulatorValue(expr->key());
2356 __ Pop(LoadDescriptor::ReceiverRegister()); 2364 __ Move(LoadDescriptor::NameRegister(), x0);
2357 EmitKeyedPropertyLoad(expr); 2365 __ Pop(LoadDescriptor::ReceiverRegister());
2366 EmitKeyedPropertyLoad(expr);
2367 } else {
2368 VisitForStackValue(expr->obj()->AsSuperReference()->this_var());
2369 EmitLoadHomeObject(expr->obj()->AsSuperReference());
2370 __ Push(result_register());
2371 VisitForStackValue(expr->key());
2372 EmitKeyedSuperPropertyLoad(expr);
2373 }
2358 context()->Plug(x0); 2374 context()->Plug(x0);
2359 } 2375 }
2360 } 2376 }
2361 2377
2362 2378
2363 void FullCodeGenerator::CallIC(Handle<Code> code, 2379 void FullCodeGenerator::CallIC(Handle<Code> code,
2364 TypeFeedbackId ast_id) { 2380 TypeFeedbackId ast_id) {
2365 ic_total_count_++; 2381 ic_total_count_++;
2366 // All calls must have a predictable size in full-codegen code to ensure that 2382 // All calls must have a predictable size in full-codegen code to ensure that
2367 // the debugger can patch them correctly. 2383 // the debugger can patch them correctly.
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
2456 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2472 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2457 2473
2458 // Push the target function under the receiver. 2474 // Push the target function under the receiver.
2459 __ Pop(x10); 2475 __ Pop(x10);
2460 __ Push(x0, x10); 2476 __ Push(x0, x10);
2461 2477
2462 EmitCall(expr, CallICState::METHOD); 2478 EmitCall(expr, CallICState::METHOD);
2463 } 2479 }
2464 2480
2465 2481
2482 void FullCodeGenerator::EmitKeyedSuperCallWithLoadIC(Call* expr) {
2483 Expression* callee = expr->expression();
2484 DCHECK(callee->IsProperty());
2485 Property* prop = callee->AsProperty();
2486 DCHECK(prop->IsSuperAccess());
2487
2488 SetSourcePosition(prop->position());
2489
2490 // Load the function from the receiver.
2491 const Register scratch = x10;
2492 SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference();
2493 EmitLoadHomeObject(super_ref);
2494 __ Push(x0);
2495 VisitForAccumulatorValue(super_ref->this_var());
2496 __ Push(x0);
2497 __ Peek(scratch, kPointerSize);
2498 __ Push(x0, scratch);
2499 VisitForStackValue(prop->key());
2500
2501 // Stack here:
2502 // - home_object
2503 // - this (receiver)
2504 // - this (receiver) <-- LoadKeyedFromSuper will pop here and below.
2505 // - home_object
2506 // - key
2507 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
2508
2509 // Replace home_object with target function.
2510 __ Poke(x0, kPointerSize);
2511
2512 // Stack here:
2513 // - target function
2514 // - this (receiver)
2515 EmitCall(expr, CallICState::METHOD);
2516 }
2517
2518
2466 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) { 2519 void FullCodeGenerator::EmitCall(Call* expr, CallICState::CallType call_type) {
2467 // Load the arguments. 2520 // Load the arguments.
2468 ZoneList<Expression*>* args = expr->arguments(); 2521 ZoneList<Expression*>* args = expr->arguments();
2469 int arg_count = args->length(); 2522 int arg_count = args->length();
2470 { PreservePositionScope scope(masm()->positions_recorder()); 2523 { PreservePositionScope scope(masm()->positions_recorder());
2471 for (int i = 0; i < arg_count; i++) { 2524 for (int i = 0; i < arg_count; i++) {
2472 VisitForStackValue(args->at(i)); 2525 VisitForStackValue(args->at(i));
2473 } 2526 }
2474 } 2527 }
2475 // Record source position of the IC call. 2528 // Record source position of the IC call.
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
2609 __ Push(x0, x1); 2662 __ Push(x0, x1);
2610 __ Bind(&call); 2663 __ Bind(&call);
2611 } 2664 }
2612 2665
2613 // The receiver is either the global receiver or an object found 2666 // The receiver is either the global receiver or an object found
2614 // by LoadContextSlot. 2667 // by LoadContextSlot.
2615 EmitCall(expr); 2668 EmitCall(expr);
2616 } else if (call_type == Call::PROPERTY_CALL) { 2669 } else if (call_type == Call::PROPERTY_CALL) {
2617 Property* property = callee->AsProperty(); 2670 Property* property = callee->AsProperty();
2618 bool is_named_call = property->key()->IsPropertyName(); 2671 bool is_named_call = property->key()->IsPropertyName();
2619 // super.x() is handled in EmitCallWithLoadIC. 2672 if (property->IsSuperAccess()) {
2620 if (property->IsSuperAccess() && is_named_call) { 2673 if (is_named_call) {
2621 EmitSuperCallWithLoadIC(expr); 2674 EmitSuperCallWithLoadIC(expr);
2675 } else {
2676 EmitKeyedSuperCallWithLoadIC(expr);
2677 }
2622 } else { 2678 } else {
2623 { 2679 {
2624 PreservePositionScope scope(masm()->positions_recorder()); 2680 PreservePositionScope scope(masm()->positions_recorder());
2625 VisitForStackValue(property->obj()); 2681 VisitForStackValue(property->obj());
2626 } 2682 }
2627 if (is_named_call) { 2683 if (is_named_call) {
2628 EmitCallWithLoadIC(expr); 2684 EmitCallWithLoadIC(expr);
2629 } else { 2685 } else {
2630 EmitKeyedCallWithLoadIC(expr, property->key()); 2686 EmitKeyedCallWithLoadIC(expr, property->key());
2631 } 2687 }
(...skipping 2439 matching lines...) Expand 10 before | Expand all | Expand 10 after
5071 return previous_; 5127 return previous_;
5072 } 5128 }
5073 5129
5074 5130
5075 #undef __ 5131 #undef __
5076 5132
5077 5133
5078 } } // namespace v8::internal 5134 } } // namespace v8::internal
5079 5135
5080 #endif // V8_TARGET_ARCH_ARM64 5136 #endif // V8_TARGET_ARCH_ARM64
OLDNEW
« no previous file with comments | « src/arm/full-codegen-arm.cc ('k') | src/full-codegen.h » ('j') | src/runtime/runtime-classes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698