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

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

Issue 495773002: Codegen for super.x and super[x] (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 4 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
« no previous file with comments | « src/full-codegen.cc ('k') | test/mjsunit/harmony/super.js » ('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_IA32 7 #if V8_TARGET_ARCH_IA32
8 8
9 #include "src/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/codegen.h" 10 #include "src/codegen.h"
(...skipping 1260 matching lines...) Expand 10 before | Expand all | Expand 10 after
1271 context()->Plug(eax); 1271 context()->Plug(eax);
1272 } 1272 }
1273 1273
1274 1274
1275 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) { 1275 void FullCodeGenerator::VisitVariableProxy(VariableProxy* expr) {
1276 Comment cmnt(masm_, "[ VariableProxy"); 1276 Comment cmnt(masm_, "[ VariableProxy");
1277 EmitVariableLoad(expr); 1277 EmitVariableLoad(expr);
1278 } 1278 }
1279 1279
1280 1280
1281 void FullCodeGenerator::VisitSuperReference(SuperReference* expr) {
1282 Comment cnmt(masm_, "[ SuperReference ");
1283
1284 Label super_lookup_failure;
1285 __ mov(LoadIC::ReceiverRegister(),
1286 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1287
1288 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
1289 __ mov(LoadIC::NameRegister(), home_object_symbol);
1290
1291 CallLoadIC(NOT_CONTEXTUAL,
1292 expr->HomeObjectFeedbackId());
1293
1294 __ cmp(eax, isolate()->factory()->undefined_value());
1295 __ j(equal, &super_lookup_failure);
1296 __ mov(eax, FieldOperand(eax, HeapObject::kMapOffset));
1297 __ mov(eax, FieldOperand(eax, Map::kPrototypeOffset));
1298 Label done;
1299 __ jmp(&done);
1300 __ bind(&super_lookup_failure);
1301 __ push(Immediate(isolate()->factory()->empty_string()));
1302 __ CallRuntime(Runtime::kThrowReferenceError, 1);
1303 __ bind(&done);
1304 context()->Plug(eax);
1305 }
1306
1307
1308
1281 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, 1309 void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
1282 TypeofState typeof_state, 1310 TypeofState typeof_state,
1283 Label* slow) { 1311 Label* slow) {
1284 Register context = esi; 1312 Register context = esi;
1285 Register temp = edx; 1313 Register temp = edx;
1286 1314
1287 Scope* s = scope(); 1315 Scope* s = scope();
1288 while (s != NULL) { 1316 while (s != NULL) {
1289 if (s->num_heap_slots() > 0) { 1317 if (s->num_heap_slots() > 0) {
1290 if (s->calls_sloppy_eval()) { 1318 if (s->calls_sloppy_eval()) {
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after
2213 // root set. 2241 // root set.
2214 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset, 2242 __ RecordWriteField(eax, JSGeneratorObject::kResultValuePropertyOffset,
2215 ecx, edx, kDontSaveFPRegs); 2243 ecx, edx, kDontSaveFPRegs);
2216 } 2244 }
2217 2245
2218 2246
2219 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2247 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2220 SetSourcePosition(prop->position()); 2248 SetSourcePosition(prop->position());
2221 Literal* key = prop->key()->AsLiteral(); 2249 Literal* key = prop->key()->AsLiteral();
2222 DCHECK(!key->value()->IsSmi()); 2250 DCHECK(!key->value()->IsSmi());
2251
2223 __ mov(LoadIC::NameRegister(), Immediate(key->value())); 2252 __ mov(LoadIC::NameRegister(), Immediate(key->value()));
2224 if (FLAG_vector_ics) { 2253 if (FLAG_vector_ics) {
2225 __ mov(LoadIC::SlotRegister(), 2254 __ mov(LoadIC::SlotRegister(),
2226 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot()))); 2255 Immediate(Smi::FromInt(prop->PropertyFeedbackSlot())));
2227 CallLoadIC(NOT_CONTEXTUAL); 2256 CallLoadIC(NOT_CONTEXTUAL);
2228 } else { 2257 } else {
2229 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); 2258 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
2230 } 2259 }
2231 } 2260 }
2232 2261
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after
2561 // Push undefined as receiver. This is patched in the method prologue if it 2590 // Push undefined as receiver. This is patched in the method prologue if it
2562 // is a sloppy mode method. 2591 // is a sloppy mode method.
2563 __ push(Immediate(isolate()->factory()->undefined_value())); 2592 __ push(Immediate(isolate()->factory()->undefined_value()));
2564 } else { 2593 } else {
2565 // Load the function from the receiver. 2594 // Load the function from the receiver.
2566 DCHECK(callee->IsProperty()); 2595 DCHECK(callee->IsProperty());
2567 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); 2596 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0));
2568 EmitNamedPropertyLoad(callee->AsProperty()); 2597 EmitNamedPropertyLoad(callee->AsProperty());
2569 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2598 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2570 // Push the target function under the receiver. 2599 // Push the target function under the receiver.
2571 __ push(Operand(esp, 0)); 2600 if (callee->AsProperty()->IsSuperAccess()) {
2572 __ mov(Operand(esp, kPointerSize), eax); 2601 __ mov(Operand(esp, 0), eax);
2602 SuperReference* super_ref =
2603 callee->AsProperty()->obj()->AsSuperReference();
2604 VisitForStackValue(super_ref->this_var());
2605 } else {
2606 __ push(Operand(esp, 0));
2607 __ mov(Operand(esp, kPointerSize), eax);
2608 }
2573 } 2609 }
2574 2610
2575 EmitCall(expr, call_type); 2611 EmitCall(expr, call_type);
2576 } 2612 }
2577 2613
2578 2614
2579 // Code common for calls using the IC. 2615 // Code common for calls using the IC.
2580 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr, 2616 void FullCodeGenerator::EmitKeyedCallWithLoadIC(Call* expr,
2581 Expression* key) { 2617 Expression* key) {
2582 // Load the key. 2618 // Load the key.
2583 VisitForAccumulatorValue(key); 2619 VisitForAccumulatorValue(key);
2584 2620
2585 Expression* callee = expr->expression(); 2621 Expression* callee = expr->expression();
2586 2622
2587 // Load the function from the receiver. 2623 // Load the function from the receiver.
2588 DCHECK(callee->IsProperty()); 2624 DCHECK(callee->IsProperty());
2589 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0)); 2625 __ mov(LoadIC::ReceiverRegister(), Operand(esp, 0));
2590 __ mov(LoadIC::NameRegister(), eax); 2626 __ mov(LoadIC::NameRegister(), eax);
2591 EmitKeyedPropertyLoad(callee->AsProperty()); 2627 EmitKeyedPropertyLoad(callee->AsProperty());
2592 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG); 2628 PrepareForBailoutForId(callee->AsProperty()->LoadId(), TOS_REG);
2593 2629
2594 // Push the target function under the receiver. 2630 // Push the target function under the receiver.
2595 __ push(Operand(esp, 0)); 2631 if (callee->AsProperty()->IsSuperAccess()) {
2596 __ mov(Operand(esp, kPointerSize), eax); 2632 __ mov(Operand(esp, 0), eax);
2633 SuperReference* super_ref = callee->AsProperty()->obj()->AsSuperReference();
2634 VisitForStackValue(super_ref->this_var());
2635 } else {
2636 __ push(Operand(esp, 0));
2637 __ mov(Operand(esp, kPointerSize), eax);
2638 }
2597 2639
2598 EmitCall(expr, CallIC::METHOD); 2640 EmitCall(expr, CallIC::METHOD);
2599 } 2641 }
2600 2642
2601 2643
2602 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) { 2644 void FullCodeGenerator::EmitCall(Call* expr, CallIC::CallType call_type) {
2603 // Load the arguments. 2645 // Load the arguments.
2604 ZoneList<Expression*>* args = expr->arguments(); 2646 ZoneList<Expression*>* args = expr->arguments();
2605 int arg_count = args->length(); 2647 int arg_count = args->length();
2606 { PreservePositionScope scope(masm()->positions_recorder()); 2648 { PreservePositionScope scope(masm()->positions_recorder());
(...skipping 2218 matching lines...) Expand 10 before | Expand all | Expand 10 after
4825 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4867 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4826 Assembler::target_address_at(call_target_address, 4868 Assembler::target_address_at(call_target_address,
4827 unoptimized_code)); 4869 unoptimized_code));
4828 return OSR_AFTER_STACK_CHECK; 4870 return OSR_AFTER_STACK_CHECK;
4829 } 4871 }
4830 4872
4831 4873
4832 } } // namespace v8::internal 4874 } } // namespace v8::internal
4833 4875
4834 #endif // V8_TARGET_ARCH_IA32 4876 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/full-codegen.cc ('k') | test/mjsunit/harmony/super.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698