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

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

Issue 754303003: Flesh out vector ic state query and set mechanisms. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Patch one. Created 6 years 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_IA32 7 #if V8_TARGET_ARCH_IA32
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 1236 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 1247
1248 __ mov(LoadDescriptor::ReceiverRegister(), 1248 __ mov(LoadDescriptor::ReceiverRegister(),
1249 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1249 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1250 1250
1251 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); 1251 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
1252 __ mov(LoadDescriptor::NameRegister(), home_object_symbol); 1252 __ mov(LoadDescriptor::NameRegister(), home_object_symbol);
1253 1253
1254 if (FLAG_vector_ics) { 1254 if (FLAG_vector_ics) {
1255 __ mov(VectorLoadICDescriptor::SlotRegister(), 1255 __ mov(VectorLoadICDescriptor::SlotRegister(),
1256 Immediate(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); 1256 Immediate(SmiFromSlot(expr->HomeObjectFeedbackSlot())));
1257 FeedbackVector()->SetKind(expr->HomeObjectFeedbackSlot(), Code::LOAD_IC);
1257 CallLoadIC(NOT_CONTEXTUAL); 1258 CallLoadIC(NOT_CONTEXTUAL);
1258 } else { 1259 } else {
1259 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId()); 1260 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId());
1260 } 1261 }
1261 1262
1262 __ cmp(eax, isolate()->factory()->undefined_value()); 1263 __ cmp(eax, isolate()->factory()->undefined_value());
1263 Label done; 1264 Label done;
1264 __ j(not_equal, &done); 1265 __ j(not_equal, &done);
1265 __ CallRuntime(Runtime::kThrowNonMethodError, 0); 1266 __ CallRuntime(Runtime::kThrowNonMethodError, 0);
1266 __ bind(&done); 1267 __ bind(&done);
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
1328 __ bind(&fast); 1329 __ bind(&fast);
1329 } 1330 }
1330 1331
1331 // All extension objects were empty and it is safe to use a global 1332 // All extension objects were empty and it is safe to use a global
1332 // load IC call. 1333 // load IC call.
1333 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1334 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1334 __ mov(LoadDescriptor::NameRegister(), proxy->var()->name()); 1335 __ mov(LoadDescriptor::NameRegister(), proxy->var()->name());
1335 if (FLAG_vector_ics) { 1336 if (FLAG_vector_ics) {
1336 __ mov(VectorLoadICDescriptor::SlotRegister(), 1337 __ mov(VectorLoadICDescriptor::SlotRegister(),
1337 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1338 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
1339 FeedbackVector()->SetKind(proxy->VariableFeedbackSlot(), Code::LOAD_IC);
1338 } 1340 }
1339 1341
1340 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) 1342 ContextualMode mode = (typeof_state == INSIDE_TYPEOF)
1341 ? NOT_CONTEXTUAL 1343 ? NOT_CONTEXTUAL
1342 : CONTEXTUAL; 1344 : CONTEXTUAL;
1343 1345
1344 CallLoadIC(mode); 1346 CallLoadIC(mode);
1345 } 1347 }
1346 1348
1347 1349
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
1415 // Three cases: global variables, lookup variables, and all other types of 1417 // Three cases: global variables, lookup variables, and all other types of
1416 // variables. 1418 // variables.
1417 switch (var->location()) { 1419 switch (var->location()) {
1418 case Variable::UNALLOCATED: { 1420 case Variable::UNALLOCATED: {
1419 Comment cmnt(masm_, "[ Global variable"); 1421 Comment cmnt(masm_, "[ Global variable");
1420 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1422 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1421 __ mov(LoadDescriptor::NameRegister(), var->name()); 1423 __ mov(LoadDescriptor::NameRegister(), var->name());
1422 if (FLAG_vector_ics) { 1424 if (FLAG_vector_ics) {
1423 __ mov(VectorLoadICDescriptor::SlotRegister(), 1425 __ mov(VectorLoadICDescriptor::SlotRegister(),
1424 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); 1426 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
1427 FeedbackVector()->SetKind(proxy->VariableFeedbackSlot(), Code::LOAD_IC);
1425 } 1428 }
1426 CallLoadIC(CONTEXTUAL); 1429 CallLoadIC(CONTEXTUAL);
1427 context()->Plug(eax); 1430 context()->Plug(eax);
1428 break; 1431 break;
1429 } 1432 }
1430 1433
1431 case Variable::PARAMETER: 1434 case Variable::PARAMETER:
1432 case Variable::LOCAL: 1435 case Variable::LOCAL:
1433 case Variable::CONTEXT: { 1436 case Variable::CONTEXT: {
1434 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" 1437 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2064 __ push(load_name); // "next" 2067 __ push(load_name); // "next"
2065 __ push(Operand(esp, 2 * kPointerSize)); // iter 2068 __ push(Operand(esp, 2 * kPointerSize)); // iter
2066 __ push(eax); // received 2069 __ push(eax); // received
2067 2070
2068 // result = receiver[f](arg); 2071 // result = receiver[f](arg);
2069 __ bind(&l_call); 2072 __ bind(&l_call);
2070 __ mov(load_receiver, Operand(esp, kPointerSize)); 2073 __ mov(load_receiver, Operand(esp, kPointerSize));
2071 if (FLAG_vector_ics) { 2074 if (FLAG_vector_ics) {
2072 __ mov(VectorLoadICDescriptor::SlotRegister(), 2075 __ mov(VectorLoadICDescriptor::SlotRegister(),
2073 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); 2076 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2077 FeedbackVector()->SetKind(expr->KeyedLoadFeedbackSlot(),
2078 Code::KEYED_LOAD_IC);
2074 } 2079 }
2075 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2080 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
2076 CallIC(ic, TypeFeedbackId::None()); 2081 CallIC(ic, TypeFeedbackId::None());
2077 __ mov(edi, eax); 2082 __ mov(edi, eax);
2078 __ mov(Operand(esp, 2 * kPointerSize), edi); 2083 __ mov(Operand(esp, 2 * kPointerSize), edi);
2079 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2084 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
2080 __ CallStub(&stub); 2085 __ CallStub(&stub);
2081 2086
2082 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2087 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2083 __ Drop(1); // The function is still on the stack; drop it. 2088 __ Drop(1); // The function is still on the stack; drop it.
2084 2089
2085 // if (!result.done) goto l_try; 2090 // if (!result.done) goto l_try;
2086 __ bind(&l_loop); 2091 __ bind(&l_loop);
2087 __ push(eax); // save result 2092 __ push(eax); // save result
2088 __ Move(load_receiver, eax); // result 2093 __ Move(load_receiver, eax); // result
2089 __ mov(load_name, 2094 __ mov(load_name,
2090 isolate()->factory()->done_string()); // "done" 2095 isolate()->factory()->done_string()); // "done"
2091 if (FLAG_vector_ics) { 2096 if (FLAG_vector_ics) {
2092 __ mov(VectorLoadICDescriptor::SlotRegister(), 2097 __ mov(VectorLoadICDescriptor::SlotRegister(),
2093 Immediate(SmiFromSlot(expr->DoneFeedbackSlot()))); 2098 Immediate(SmiFromSlot(expr->DoneFeedbackSlot())));
2099 FeedbackVector()->SetKind(expr->DoneFeedbackSlot(), Code::LOAD_IC);
2094 } 2100 }
2095 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax 2101 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax
2096 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); 2102 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
2097 CallIC(bool_ic); 2103 CallIC(bool_ic);
2098 __ test(eax, eax); 2104 __ test(eax, eax);
2099 __ j(zero, &l_try); 2105 __ j(zero, &l_try);
2100 2106
2101 // result.value 2107 // result.value
2102 __ pop(load_receiver); // result 2108 __ pop(load_receiver); // result
2103 __ mov(load_name, 2109 __ mov(load_name,
2104 isolate()->factory()->value_string()); // "value" 2110 isolate()->factory()->value_string()); // "value"
2105 if (FLAG_vector_ics) { 2111 if (FLAG_vector_ics) {
2106 __ mov(VectorLoadICDescriptor::SlotRegister(), 2112 __ mov(VectorLoadICDescriptor::SlotRegister(),
2107 Immediate(SmiFromSlot(expr->ValueFeedbackSlot()))); 2113 Immediate(SmiFromSlot(expr->ValueFeedbackSlot())));
2114 FeedbackVector()->SetKind(expr->ValueFeedbackSlot(), Code::LOAD_IC);
2108 } 2115 }
2109 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax 2116 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax
2110 context()->DropAndPlug(2, eax); // drop iter and g 2117 context()->DropAndPlug(2, eax); // drop iter and g
2111 break; 2118 break;
2112 } 2119 }
2113 } 2120 }
2114 } 2121 }
2115 2122
2116 2123
2117 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, 2124 void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
2239 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2246 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2240 SetSourcePosition(prop->position()); 2247 SetSourcePosition(prop->position());
2241 Literal* key = prop->key()->AsLiteral(); 2248 Literal* key = prop->key()->AsLiteral();
2242 DCHECK(!key->value()->IsSmi()); 2249 DCHECK(!key->value()->IsSmi());
2243 DCHECK(!prop->IsSuperAccess()); 2250 DCHECK(!prop->IsSuperAccess());
2244 2251
2245 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); 2252 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value()));
2246 if (FLAG_vector_ics) { 2253 if (FLAG_vector_ics) {
2247 __ mov(VectorLoadICDescriptor::SlotRegister(), 2254 __ mov(VectorLoadICDescriptor::SlotRegister(),
2248 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2255 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
2256 FeedbackVector()->SetKind(prop->PropertyFeedbackSlot(), Code::LOAD_IC);
2249 CallLoadIC(NOT_CONTEXTUAL); 2257 CallLoadIC(NOT_CONTEXTUAL);
2250 } else { 2258 } else {
2251 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId()); 2259 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
2252 } 2260 }
2253 } 2261 }
2254 2262
2255 2263
2256 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { 2264 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
2257 // Stack: receiver, home_object. 2265 // Stack: receiver, home_object.
2258 SetSourcePosition(prop->position()); 2266 SetSourcePosition(prop->position());
2259 Literal* key = prop->key()->AsLiteral(); 2267 Literal* key = prop->key()->AsLiteral();
2260 DCHECK(!key->value()->IsSmi()); 2268 DCHECK(!key->value()->IsSmi());
2261 DCHECK(prop->IsSuperAccess()); 2269 DCHECK(prop->IsSuperAccess());
2262 2270
2263 __ push(Immediate(key->value())); 2271 __ push(Immediate(key->value()));
2264 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2272 __ CallRuntime(Runtime::kLoadFromSuper, 3);
2265 } 2273 }
2266 2274
2267 2275
2268 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2276 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2269 SetSourcePosition(prop->position()); 2277 SetSourcePosition(prop->position());
2270 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2278 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
2271 if (FLAG_vector_ics) { 2279 if (FLAG_vector_ics) {
2272 __ mov(VectorLoadICDescriptor::SlotRegister(), 2280 __ mov(VectorLoadICDescriptor::SlotRegister(),
2273 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2281 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
2282 FeedbackVector()->SetKind(prop->PropertyFeedbackSlot(),
2283 Code::KEYED_LOAD_IC);
2274 CallIC(ic); 2284 CallIC(ic);
2275 } else { 2285 } else {
2276 CallIC(ic, prop->PropertyFeedbackId()); 2286 CallIC(ic, prop->PropertyFeedbackId());
2277 } 2287 }
2278 } 2288 }
2279 2289
2280 2290
2281 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2291 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2282 // Stack: receiver, home_object, key. 2292 // Stack: receiver, home_object, key.
2283 SetSourcePosition(prop->position()); 2293 SetSourcePosition(prop->position());
(...skipping 562 matching lines...) Expand 10 before | Expand all | Expand 10 after
2846 } 2856 }
2847 2857
2848 // Record source position of the IC call. 2858 // Record source position of the IC call.
2849 SetSourcePosition(expr->position()); 2859 SetSourcePosition(expr->position());
2850 Handle<Code> ic = CallIC::initialize_stub( 2860 Handle<Code> ic = CallIC::initialize_stub(
2851 isolate(), arg_count, call_type); 2861 isolate(), arg_count, call_type);
2852 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot()))); 2862 __ Move(edx, Immediate(SmiFromSlot(expr->CallFeedbackSlot())));
2853 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize)); 2863 __ mov(edi, Operand(esp, (arg_count + 1) * kPointerSize));
2854 // Don't assign a type feedback id to the IC, since type feedback is provided 2864 // Don't assign a type feedback id to the IC, since type feedback is provided
2855 // by the vector above. 2865 // by the vector above.
2866 FeedbackVector()->SetKind(expr->CallFeedbackSlot(), Code::CALL_IC);
2856 CallIC(ic); 2867 CallIC(ic);
2857 2868
2858 RecordJSReturnSite(expr); 2869 RecordJSReturnSite(expr);
2859 2870
2860 // Restore context register. 2871 // Restore context register.
2861 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2872 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2862 2873
2863 context()->DropAndPlug(1, eax); 2874 context()->DropAndPlug(1, eax);
2864 } 2875 }
2865 2876
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
4336 // Push the builtins object as receiver. 4347 // Push the builtins object as receiver.
4337 __ mov(eax, GlobalObjectOperand()); 4348 __ mov(eax, GlobalObjectOperand());
4338 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); 4349 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset));
4339 4350
4340 // Load the function from the receiver. 4351 // Load the function from the receiver.
4341 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); 4352 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0));
4342 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name())); 4353 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name()));
4343 if (FLAG_vector_ics) { 4354 if (FLAG_vector_ics) {
4344 __ mov(VectorLoadICDescriptor::SlotRegister(), 4355 __ mov(VectorLoadICDescriptor::SlotRegister(),
4345 Immediate(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); 4356 Immediate(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
4357 FeedbackVector()->SetKind(expr->CallRuntimeFeedbackSlot(), Code::LOAD_IC);
4346 CallLoadIC(NOT_CONTEXTUAL); 4358 CallLoadIC(NOT_CONTEXTUAL);
4347 } else { 4359 } else {
4348 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId()); 4360 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
4349 } 4361 }
4350 4362
4351 // Push the target function under the receiver. 4363 // Push the target function under the receiver.
4352 __ push(Operand(esp, 0)); 4364 __ push(Operand(esp, 0));
4353 __ mov(Operand(esp, kPointerSize), eax); 4365 __ mov(Operand(esp, kPointerSize), eax);
4354 4366
4355 // Code common for calls using the IC. 4367 // Code common for calls using the IC.
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
4748 DCHECK(!context()->IsEffect()); 4760 DCHECK(!context()->IsEffect());
4749 DCHECK(!context()->IsTest()); 4761 DCHECK(!context()->IsTest());
4750 4762
4751 if (proxy != NULL && proxy->var()->IsUnallocated()) { 4763 if (proxy != NULL && proxy->var()->IsUnallocated()) {
4752 Comment cmnt(masm_, "[ Global variable"); 4764 Comment cmnt(masm_, "[ Global variable");
4753 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 4765 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
4754 __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name())); 4766 __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name()));
4755 if (FLAG_vector_ics) { 4767 if (FLAG_vector_ics) {
4756 __ mov(VectorLoadICDescriptor::SlotRegister(), 4768 __ mov(VectorLoadICDescriptor::SlotRegister(),
4757 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot()))); 4769 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
4770 FeedbackVector()->SetKind(proxy->VariableFeedbackSlot(), Code::LOAD_IC);
4758 } 4771 }
4759 // Use a regular load, not a contextual load, to avoid a reference 4772 // Use a regular load, not a contextual load, to avoid a reference
4760 // error. 4773 // error.
4761 CallLoadIC(NOT_CONTEXTUAL); 4774 CallLoadIC(NOT_CONTEXTUAL);
4762 PrepareForBailout(expr, TOS_REG); 4775 PrepareForBailout(expr, TOS_REG);
4763 context()->Plug(eax); 4776 context()->Plug(eax);
4764 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { 4777 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
4765 Comment cmnt(masm_, "[ Lookup slot"); 4778 Comment cmnt(masm_, "[ Lookup slot");
4766 Label done, slow; 4779 Label done, slow;
4767 4780
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
5176 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5189 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5177 Assembler::target_address_at(call_target_address, 5190 Assembler::target_address_at(call_target_address,
5178 unoptimized_code)); 5191 unoptimized_code));
5179 return OSR_AFTER_STACK_CHECK; 5192 return OSR_AFTER_STACK_CHECK;
5180 } 5193 }
5181 5194
5182 5195
5183 } } // namespace v8::internal 5196 } } // namespace v8::internal
5184 5197
5185 #endif // V8_TARGET_ARCH_IA32 5198 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ast-numbering.cc ('k') | src/ic/ia32/ic-ia32.cc » ('j') | src/ic/ia32/ic-ia32.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698