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

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

Issue 408183003: Express LoadIC extra ic state with LoadIC::State (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Ports. Created 6 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 | Annotate | Revision Log
« no previous file with comments | « src/x64/codegen-x64.h ('k') | src/x64/lithium-codegen-x64.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_X64 7 #if V8_TARGET_ARCH_X64
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 1361 matching lines...) Expand 10 before | Expand all | Expand 10 after
1372 1372
1373 // All extension objects were empty and it is safe to use a global 1373 // All extension objects were empty and it is safe to use a global
1374 // load IC call. 1374 // load IC call.
1375 __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand()); 1375 __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand());
1376 __ Move(LoadIC::NameRegister(), proxy->var()->name()); 1376 __ Move(LoadIC::NameRegister(), proxy->var()->name());
1377 if (FLAG_vector_ics) { 1377 if (FLAG_vector_ics) {
1378 __ Move(LoadIC::SlotRegister(), 1378 __ Move(LoadIC::SlotRegister(),
1379 Smi::FromInt(proxy->VariableFeedbackSlot())); 1379 Smi::FromInt(proxy->VariableFeedbackSlot()));
1380 } 1380 }
1381 1381
1382 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) 1382 CallLoadIC(typeof_state);
1383 ? NOT_CONTEXTUAL
1384 : CONTEXTUAL;
1385 CallLoadIC(mode);
1386 } 1383 }
1387 1384
1388 1385
1389 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, 1386 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var,
1390 Label* slow) { 1387 Label* slow) {
1391 ASSERT(var->IsContextSlot()); 1388 ASSERT(var->IsContextSlot());
1392 Register context = rsi; 1389 Register context = rsi;
1393 Register temp = rbx; 1390 Register temp = rbx;
1394 1391
1395 for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { 1392 for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) {
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1457 // variables. 1454 // variables.
1458 switch (var->location()) { 1455 switch (var->location()) {
1459 case Variable::UNALLOCATED: { 1456 case Variable::UNALLOCATED: {
1460 Comment cmnt(masm_, "[ Global variable"); 1457 Comment cmnt(masm_, "[ Global variable");
1461 __ Move(LoadIC::NameRegister(), var->name()); 1458 __ Move(LoadIC::NameRegister(), var->name());
1462 __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand()); 1459 __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand());
1463 if (FLAG_vector_ics) { 1460 if (FLAG_vector_ics) {
1464 __ Move(LoadIC::SlotRegister(), 1461 __ Move(LoadIC::SlotRegister(),
1465 Smi::FromInt(proxy->VariableFeedbackSlot())); 1462 Smi::FromInt(proxy->VariableFeedbackSlot()));
1466 } 1463 }
1467 CallLoadIC(CONTEXTUAL); 1464 CallLoadIC(NOT_INSIDE_TYPEOF);
1468 context()->Plug(rax); 1465 context()->Plug(rax);
1469 break; 1466 break;
1470 } 1467 }
1471 1468
1472 case Variable::PARAMETER: 1469 case Variable::PARAMETER:
1473 case Variable::LOCAL: 1470 case Variable::LOCAL:
1474 case Variable::CONTEXT: { 1471 case Variable::CONTEXT: {
1475 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context slot" 1472 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context slot"
1476 : "[ Stack slot"); 1473 : "[ Stack slot");
1477 if (var->binding_needs_init()) { 1474 if (var->binding_needs_init()) {
(...skipping 602 matching lines...) Expand 10 before | Expand all | Expand 10 after
2080 __ Drop(1); // The function is still on the stack; drop it. 2077 __ Drop(1); // The function is still on the stack; drop it.
2081 2078
2082 // if (!result.done) goto l_try; 2079 // if (!result.done) goto l_try;
2083 __ bind(&l_loop); 2080 __ bind(&l_loop);
2084 __ Move(load_receiver, rax); 2081 __ Move(load_receiver, rax);
2085 __ Push(load_receiver); // save result 2082 __ Push(load_receiver); // save result
2086 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" 2083 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done"
2087 if (FLAG_vector_ics) { 2084 if (FLAG_vector_ics) {
2088 __ Move(LoadIC::SlotRegister(), Smi::FromInt(expr->DoneFeedbackSlot())); 2085 __ Move(LoadIC::SlotRegister(), Smi::FromInt(expr->DoneFeedbackSlot()));
2089 } 2086 }
2090 CallLoadIC(NOT_CONTEXTUAL); // rax=result.done 2087 CallLoadIC(); // rax=result.done
2091 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); 2088 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
2092 CallIC(bool_ic); 2089 CallIC(bool_ic);
2093 __ testp(result_register(), result_register()); 2090 __ testp(result_register(), result_register());
2094 __ j(zero, &l_try); 2091 __ j(zero, &l_try);
2095 2092
2096 // result.value 2093 // result.value
2097 __ Pop(load_receiver); // result 2094 __ Pop(load_receiver); // result
2098 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" 2095 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value"
2099 if (FLAG_vector_ics) { 2096 if (FLAG_vector_ics) {
2100 __ Move(LoadIC::SlotRegister(), 2097 __ Move(LoadIC::SlotRegister(),
2101 Smi::FromInt(expr->ValueFeedbackSlot())); 2098 Smi::FromInt(expr->ValueFeedbackSlot()));
2102 } 2099 }
2103 CallLoadIC(NOT_CONTEXTUAL); // result.value in rax 2100 CallLoadIC(); // result.value in rax
2104 context()->DropAndPlug(2, rax); // drop iter and g 2101 context()->DropAndPlug(2, rax); // drop iter and g
2105 break; 2102 break;
2106 } 2103 }
2107 } 2104 }
2108 } 2105 }
2109 2106
2110 2107
2111 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, 2108 void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
2112 Expression *value, 2109 Expression *value,
2113 JSGeneratorObject::ResumeMode resume_mode) { 2110 JSGeneratorObject::ResumeMode resume_mode) {
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
2256 rcx, rdx, kDontSaveFPRegs); 2253 rcx, rdx, kDontSaveFPRegs);
2257 } 2254 }
2258 2255
2259 2256
2260 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2257 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2261 SetSourcePosition(prop->position()); 2258 SetSourcePosition(prop->position());
2262 Literal* key = prop->key()->AsLiteral(); 2259 Literal* key = prop->key()->AsLiteral();
2263 __ Move(LoadIC::NameRegister(), key->value()); 2260 __ Move(LoadIC::NameRegister(), key->value());
2264 if (FLAG_vector_ics) { 2261 if (FLAG_vector_ics) {
2265 __ Move(LoadIC::SlotRegister(), Smi::FromInt(prop->PropertyFeedbackSlot())); 2262 __ Move(LoadIC::SlotRegister(), Smi::FromInt(prop->PropertyFeedbackSlot()));
2266 CallLoadIC(NOT_CONTEXTUAL); 2263 CallLoadIC(INSIDE_TYPEOF);
2267 } else { 2264 } else {
2268 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); 2265 CallLoadIC(INSIDE_TYPEOF, prop->PropertyFeedbackId());
2269 } 2266 }
2270 } 2267 }
2271 2268
2272 2269
2273 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2270 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2274 SetSourcePosition(prop->position()); 2271 SetSourcePosition(prop->position());
2275 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize(); 2272 Handle<Code> ic = isolate()->builtins()->KeyedLoadIC_Initialize();
2276 if (FLAG_vector_ics) { 2273 if (FLAG_vector_ics) {
2277 __ Move(LoadIC::SlotRegister(), Smi::FromInt(prop->PropertyFeedbackSlot())); 2274 __ Move(LoadIC::SlotRegister(), Smi::FromInt(prop->PropertyFeedbackSlot()));
2278 CallIC(ic); 2275 CallIC(ic);
(...skipping 1784 matching lines...) Expand 10 before | Expand all | Expand 10 after
4063 // Push the builtins object as receiver. 4060 // Push the builtins object as receiver.
4064 __ movp(rax, GlobalObjectOperand()); 4061 __ movp(rax, GlobalObjectOperand());
4065 __ Push(FieldOperand(rax, GlobalObject::kBuiltinsOffset)); 4062 __ Push(FieldOperand(rax, GlobalObject::kBuiltinsOffset));
4066 4063
4067 // Load the function from the receiver. 4064 // Load the function from the receiver.
4068 __ movp(LoadIC::ReceiverRegister(), Operand(rsp, 0)); 4065 __ movp(LoadIC::ReceiverRegister(), Operand(rsp, 0));
4069 __ Move(LoadIC::NameRegister(), expr->name()); 4066 __ Move(LoadIC::NameRegister(), expr->name());
4070 if (FLAG_vector_ics) { 4067 if (FLAG_vector_ics) {
4071 __ Move(LoadIC::SlotRegister(), 4068 __ Move(LoadIC::SlotRegister(),
4072 Smi::FromInt(expr->CallRuntimeFeedbackSlot())); 4069 Smi::FromInt(expr->CallRuntimeFeedbackSlot()));
4073 CallLoadIC(NOT_CONTEXTUAL); 4070 CallLoadIC(INSIDE_TYPEOF);
4074 } else { 4071 } else {
4075 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); 4072 CallLoadIC(INSIDE_TYPEOF, expr->CallRuntimeFeedbackId());
4076 } 4073 }
4077 4074
4078 // Push the target function under the receiver. 4075 // Push the target function under the receiver.
4079 __ Push(Operand(rsp, 0)); 4076 __ Push(Operand(rsp, 0));
4080 __ movp(Operand(rsp, kPointerSize), rax); 4077 __ movp(Operand(rsp, kPointerSize), rax);
4081 4078
4082 // Push the arguments ("left-to-right"). 4079 // Push the arguments ("left-to-right").
4083 for (int i = 0; i < arg_count; i++) { 4080 for (int i = 0; i < arg_count; i++) {
4084 VisitForStackValue(args->at(i)); 4081 VisitForStackValue(args->at(i));
4085 } 4082 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
4411 ASSERT(!context()->IsTest()); 4408 ASSERT(!context()->IsTest());
4412 4409
4413 if (proxy != NULL && proxy->var()->IsUnallocated()) { 4410 if (proxy != NULL && proxy->var()->IsUnallocated()) {
4414 Comment cmnt(masm_, "[ Global variable"); 4411 Comment cmnt(masm_, "[ Global variable");
4415 __ Move(LoadIC::NameRegister(), proxy->name()); 4412 __ Move(LoadIC::NameRegister(), proxy->name());
4416 __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand()); 4413 __ movp(LoadIC::ReceiverRegister(), GlobalObjectOperand());
4417 if (FLAG_vector_ics) { 4414 if (FLAG_vector_ics) {
4418 __ Move(LoadIC::SlotRegister(), 4415 __ Move(LoadIC::SlotRegister(),
4419 Smi::FromInt(proxy->VariableFeedbackSlot())); 4416 Smi::FromInt(proxy->VariableFeedbackSlot()));
4420 } 4417 }
4421 // Use a regular load, not a contextual load, to avoid a reference 4418 // We don't want a reference error if the load fails on the global object.
4422 // error. 4419 CallLoadIC();
4423 CallLoadIC(NOT_CONTEXTUAL);
4424 PrepareForBailout(expr, TOS_REG); 4420 PrepareForBailout(expr, TOS_REG);
4425 context()->Plug(rax); 4421 context()->Plug(rax);
4426 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { 4422 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
4427 Comment cmnt(masm_, "[ Lookup slot"); 4423 Comment cmnt(masm_, "[ Lookup slot");
4428 Label done, slow; 4424 Label done, slow;
4429 4425
4430 // Generate code for loading from variables potentially shadowed 4426 // Generate code for loading from variables potentially shadowed
4431 // by eval-introduced variables. 4427 // by eval-introduced variables.
4432 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done); 4428 EmitDynamicLookupFastCase(proxy, INSIDE_TYPEOF, &slow, &done);
4433 4429
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after
4841 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 4837 ASSERT_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
4842 Assembler::target_address_at(call_target_address, 4838 Assembler::target_address_at(call_target_address,
4843 unoptimized_code)); 4839 unoptimized_code));
4844 return OSR_AFTER_STACK_CHECK; 4840 return OSR_AFTER_STACK_CHECK;
4845 } 4841 }
4846 4842
4847 4843
4848 } } // namespace v8::internal 4844 } } // namespace v8::internal
4849 4845
4850 #endif // V8_TARGET_ARCH_X64 4846 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/codegen-x64.h ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698