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

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

Issue 1142713007: X87: Now that vector ics are established for load, keyed load and call ics, let's remove dead code … (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 7 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
« no previous file with comments | « src/x87/debug-x87.cc ('k') | src/x87/lithium-codegen-x87.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_X87 7 #if V8_TARGET_ARCH_X87
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 1234 matching lines...) Expand 10 before | Expand all | Expand 10 after
1245 1245
1246 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { 1246 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) {
1247 Comment cnmt(masm_, "[ SuperReference "); 1247 Comment cnmt(masm_, "[ SuperReference ");
1248 1248
1249 __ mov(LoadDescriptor::ReceiverRegister(), 1249 __ mov(LoadDescriptor::ReceiverRegister(),
1250 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); 1250 Operand(ebp, JavaScriptFrameConstants::kFunctionOffset));
1251 1251
1252 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); 1252 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
1253 __ mov(LoadDescriptor::NameRegister(), home_object_symbol); 1253 __ mov(LoadDescriptor::NameRegister(), home_object_symbol);
1254 1254
1255 if (FLAG_vector_ics) { 1255 __ mov(VectorLoadICDescriptor::SlotRegister(),
1256 __ mov(VectorLoadICDescriptor::SlotRegister(), 1256 Immediate(SmiFromSlot(expr->HomeObjectFeedbackSlot())));
1257 Immediate(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); 1257 CallLoadIC(NOT_CONTEXTUAL);
1258 CallLoadIC(NOT_CONTEXTUAL);
1259 } else {
1260 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId());
1261 }
1262 1258
1263 __ cmp(eax, isolate()->factory()->undefined_value()); 1259 __ cmp(eax, isolate()->factory()->undefined_value());
1264 Label done; 1260 Label done;
1265 __ j(not_equal, &done); 1261 __ j(not_equal, &done);
1266 __ CallRuntime(Runtime::kThrowNonMethodError, 0); 1262 __ CallRuntime(Runtime::kThrowNonMethodError, 0);
1267 __ bind(&done); 1263 __ bind(&done);
1268 } 1264 }
1269 1265
1270 1266
1271 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, 1267 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 // Load next context in chain. 1322 // Load next context in chain.
1327 __ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); 1323 __ mov(temp, ContextOperand(temp, Context::PREVIOUS_INDEX));
1328 __ jmp(&next); 1324 __ jmp(&next);
1329 __ bind(&fast); 1325 __ bind(&fast);
1330 } 1326 }
1331 1327
1332 // All extension objects were empty and it is safe to use a global 1328 // All extension objects were empty and it is safe to use a global
1333 // load IC call. 1329 // load IC call.
1334 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1330 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1335 __ mov(LoadDescriptor::NameRegister(), proxy->var()->name()); 1331 __ mov(LoadDescriptor::NameRegister(), proxy->var()->name());
1336 if (FLAG_vector_ics) { 1332 __ mov(VectorLoadICDescriptor::SlotRegister(),
1337 __ mov(VectorLoadICDescriptor::SlotRegister(), 1333 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
1338 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
1339 }
1340 1334
1341 ContextualMode mode = (typeof_state == INSIDE_TYPEOF) 1335 ContextualMode mode = (typeof_state == INSIDE_TYPEOF)
1342 ? NOT_CONTEXTUAL 1336 ? NOT_CONTEXTUAL
1343 : CONTEXTUAL; 1337 : CONTEXTUAL;
1344 1338
1345 CallLoadIC(mode); 1339 CallLoadIC(mode);
1346 } 1340 }
1347 1341
1348 1342
1349 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, 1343 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var,
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1414 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); 1408 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS);
1415 Variable* var = proxy->var(); 1409 Variable* var = proxy->var();
1416 1410
1417 // Three cases: global variables, lookup variables, and all other types of 1411 // Three cases: global variables, lookup variables, and all other types of
1418 // variables. 1412 // variables.
1419 switch (var->location()) { 1413 switch (var->location()) {
1420 case Variable::UNALLOCATED: { 1414 case Variable::UNALLOCATED: {
1421 Comment cmnt(masm_, "[ Global variable"); 1415 Comment cmnt(masm_, "[ Global variable");
1422 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1416 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1423 __ mov(LoadDescriptor::NameRegister(), var->name()); 1417 __ mov(LoadDescriptor::NameRegister(), var->name());
1424 if (FLAG_vector_ics) { 1418 __ mov(VectorLoadICDescriptor::SlotRegister(),
1425 __ mov(VectorLoadICDescriptor::SlotRegister(), 1419 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
1426 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
1427 }
1428 CallGlobalLoadIC(var->name()); 1420 CallGlobalLoadIC(var->name());
1429 context()->Plug(eax); 1421 context()->Plug(eax);
1430 break; 1422 break;
1431 } 1423 }
1432 1424
1433 case Variable::PARAMETER: 1425 case Variable::PARAMETER:
1434 case Variable::LOCAL: 1426 case Variable::LOCAL:
1435 case Variable::CONTEXT: { 1427 case Variable::CONTEXT: {
1436 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" 1428 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
1437 : "[ Stack variable"); 1429 : "[ Stack variable");
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2109 __ bind(&l_next); 2101 __ bind(&l_next);
2110 2102
2111 __ mov(load_name, isolate()->factory()->next_string()); 2103 __ mov(load_name, isolate()->factory()->next_string());
2112 __ push(load_name); // "next" 2104 __ push(load_name); // "next"
2113 __ push(Operand(esp, 2 * kPointerSize)); // iter 2105 __ push(Operand(esp, 2 * kPointerSize)); // iter
2114 __ push(eax); // received 2106 __ push(eax); // received
2115 2107
2116 // result = receiver[f](arg); 2108 // result = receiver[f](arg);
2117 __ bind(&l_call); 2109 __ bind(&l_call);
2118 __ mov(load_receiver, Operand(esp, kPointerSize)); 2110 __ mov(load_receiver, Operand(esp, kPointerSize));
2119 if (FLAG_vector_ics) { 2111 __ mov(VectorLoadICDescriptor::SlotRegister(),
2120 __ mov(VectorLoadICDescriptor::SlotRegister(), 2112 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2121 Immediate(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2122 }
2123 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2113 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
2124 CallIC(ic, TypeFeedbackId::None()); 2114 CallIC(ic, TypeFeedbackId::None());
2125 __ mov(edi, eax); 2115 __ mov(edi, eax);
2126 __ mov(Operand(esp, 2 * kPointerSize), edi); 2116 __ mov(Operand(esp, 2 * kPointerSize), edi);
2127 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2117 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
2128 __ CallStub(&stub); 2118 __ CallStub(&stub);
2129 2119
2130 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset)); 2120 __ mov(esi, Operand(ebp, StandardFrameConstants::kContextOffset));
2131 __ Drop(1); // The function is still on the stack; drop it. 2121 __ Drop(1); // The function is still on the stack; drop it.
2132 2122
2133 // if (!result.done) goto l_try; 2123 // if (!result.done) goto l_try;
2134 __ bind(&l_loop); 2124 __ bind(&l_loop);
2135 __ push(eax); // save result 2125 __ push(eax); // save result
2136 __ Move(load_receiver, eax); // result 2126 __ Move(load_receiver, eax); // result
2137 __ mov(load_name, 2127 __ mov(load_name,
2138 isolate()->factory()->done_string()); // "done" 2128 isolate()->factory()->done_string()); // "done"
2139 if (FLAG_vector_ics) { 2129 __ mov(VectorLoadICDescriptor::SlotRegister(),
2140 __ mov(VectorLoadICDescriptor::SlotRegister(), 2130 Immediate(SmiFromSlot(expr->DoneFeedbackSlot())));
2141 Immediate(SmiFromSlot(expr->DoneFeedbackSlot())));
2142 }
2143 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax 2131 CallLoadIC(NOT_CONTEXTUAL); // result.done in eax
2144 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); 2132 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
2145 CallIC(bool_ic); 2133 CallIC(bool_ic);
2146 __ test(eax, eax); 2134 __ test(eax, eax);
2147 __ j(zero, &l_try); 2135 __ j(zero, &l_try);
2148 2136
2149 // result.value 2137 // result.value
2150 __ pop(load_receiver); // result 2138 __ pop(load_receiver); // result
2151 __ mov(load_name, 2139 __ mov(load_name,
2152 isolate()->factory()->value_string()); // "value" 2140 isolate()->factory()->value_string()); // "value"
2153 if (FLAG_vector_ics) { 2141 __ mov(VectorLoadICDescriptor::SlotRegister(),
2154 __ mov(VectorLoadICDescriptor::SlotRegister(), 2142 Immediate(SmiFromSlot(expr->ValueFeedbackSlot())));
2155 Immediate(SmiFromSlot(expr->ValueFeedbackSlot())));
2156 }
2157 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax 2143 CallLoadIC(NOT_CONTEXTUAL); // result.value in eax
2158 context()->DropAndPlug(2, eax); // drop iter and g 2144 context()->DropAndPlug(2, eax); // drop iter and g
2159 break; 2145 break;
2160 } 2146 }
2161 } 2147 }
2162 } 2148 }
2163 2149
2164 2150
2165 void FullCodeGenerator::EmitGeneratorResume(Expression *generator, 2151 void FullCodeGenerator::EmitGeneratorResume(Expression *generator,
2166 Expression *value, 2152 Expression *value,
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
2284 } 2270 }
2285 2271
2286 2272
2287 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2273 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2288 SetSourcePosition(prop->position()); 2274 SetSourcePosition(prop->position());
2289 Literal* key = prop->key()->AsLiteral(); 2275 Literal* key = prop->key()->AsLiteral();
2290 DCHECK(!key->value()->IsSmi()); 2276 DCHECK(!key->value()->IsSmi());
2291 DCHECK(!prop->IsSuperAccess()); 2277 DCHECK(!prop->IsSuperAccess());
2292 2278
2293 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value())); 2279 __ mov(LoadDescriptor::NameRegister(), Immediate(key->value()));
2294 if (FLAG_vector_ics) { 2280 __ mov(VectorLoadICDescriptor::SlotRegister(),
2295 __ mov(VectorLoadICDescriptor::SlotRegister(), 2281 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
2296 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2282 CallLoadIC(NOT_CONTEXTUAL);
2297 CallLoadIC(NOT_CONTEXTUAL);
2298 } else {
2299 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
2300 }
2301 } 2283 }
2302 2284
2303 2285
2304 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { 2286 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
2305 // Stack: receiver, home_object. 2287 // Stack: receiver, home_object.
2306 SetSourcePosition(prop->position()); 2288 SetSourcePosition(prop->position());
2307 Literal* key = prop->key()->AsLiteral(); 2289 Literal* key = prop->key()->AsLiteral();
2308 DCHECK(!key->value()->IsSmi()); 2290 DCHECK(!key->value()->IsSmi());
2309 DCHECK(prop->IsSuperAccess()); 2291 DCHECK(prop->IsSuperAccess());
2310 2292
2311 __ push(Immediate(key->value())); 2293 __ push(Immediate(key->value()));
2312 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2294 __ CallRuntime(Runtime::kLoadFromSuper, 3);
2313 } 2295 }
2314 2296
2315 2297
2316 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2298 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2317 SetSourcePosition(prop->position()); 2299 SetSourcePosition(prop->position());
2318 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2300 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
2319 if (FLAG_vector_ics) { 2301 __ mov(VectorLoadICDescriptor::SlotRegister(),
2320 __ mov(VectorLoadICDescriptor::SlotRegister(), 2302 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot())));
2321 Immediate(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2303 CallIC(ic);
2322 CallIC(ic);
2323 } else {
2324 CallIC(ic, prop->PropertyFeedbackId());
2325 }
2326 } 2304 }
2327 2305
2328 2306
2329 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2307 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2330 // Stack: receiver, home_object, key. 2308 // Stack: receiver, home_object, key.
2331 SetSourcePosition(prop->position()); 2309 SetSourcePosition(prop->position());
2332 2310
2333 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2311 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
2334 } 2312 }
2335 2313
(...skipping 2200 matching lines...) Expand 10 before | Expand all | Expand 10 after
4536 4514
4537 4515
4538 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4516 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4539 // Push the builtins object as receiver. 4517 // Push the builtins object as receiver.
4540 __ mov(eax, GlobalObjectOperand()); 4518 __ mov(eax, GlobalObjectOperand());
4541 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset)); 4519 __ push(FieldOperand(eax, GlobalObject::kBuiltinsOffset));
4542 4520
4543 // Load the function from the receiver. 4521 // Load the function from the receiver.
4544 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0)); 4522 __ mov(LoadDescriptor::ReceiverRegister(), Operand(esp, 0));
4545 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name())); 4523 __ mov(LoadDescriptor::NameRegister(), Immediate(expr->name()));
4546 if (FLAG_vector_ics) { 4524 __ mov(VectorLoadICDescriptor::SlotRegister(),
4547 __ mov(VectorLoadICDescriptor::SlotRegister(), 4525 Immediate(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
4548 Immediate(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); 4526 CallLoadIC(NOT_CONTEXTUAL);
4549 CallLoadIC(NOT_CONTEXTUAL);
4550 } else {
4551 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
4552 }
4553 } 4527 }
4554 4528
4555 4529
4556 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 4530 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4557 ZoneList<Expression*>* args = expr->arguments(); 4531 ZoneList<Expression*>* args = expr->arguments();
4558 int arg_count = args->length(); 4532 int arg_count = args->length();
4559 4533
4560 // Record source position of the IC call. 4534 // Record source position of the IC call.
4561 SetSourcePosition(expr->position()); 4535 SetSourcePosition(expr->position());
4562 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); 4536 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
4981 4955
4982 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { 4956 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
4983 VariableProxy* proxy = expr->AsVariableProxy(); 4957 VariableProxy* proxy = expr->AsVariableProxy();
4984 DCHECK(!context()->IsEffect()); 4958 DCHECK(!context()->IsEffect());
4985 DCHECK(!context()->IsTest()); 4959 DCHECK(!context()->IsTest());
4986 4960
4987 if (proxy != NULL && proxy->var()->IsUnallocated()) { 4961 if (proxy != NULL && proxy->var()->IsUnallocated()) {
4988 Comment cmnt(masm_, "[ Global variable"); 4962 Comment cmnt(masm_, "[ Global variable");
4989 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 4963 __ mov(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
4990 __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name())); 4964 __ mov(LoadDescriptor::NameRegister(), Immediate(proxy->name()));
4991 if (FLAG_vector_ics) { 4965 __ mov(VectorLoadICDescriptor::SlotRegister(),
4992 __ mov(VectorLoadICDescriptor::SlotRegister(), 4966 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
4993 Immediate(SmiFromSlot(proxy->VariableFeedbackSlot())));
4994 }
4995 // Use a regular load, not a contextual load, to avoid a reference 4967 // Use a regular load, not a contextual load, to avoid a reference
4996 // error. 4968 // error.
4997 CallLoadIC(NOT_CONTEXTUAL); 4969 CallLoadIC(NOT_CONTEXTUAL);
4998 PrepareForBailout(expr, TOS_REG); 4970 PrepareForBailout(expr, TOS_REG);
4999 context()->Plug(eax); 4971 context()->Plug(eax);
5000 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { 4972 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
5001 Comment cmnt(masm_, "[ Lookup slot"); 4973 Comment cmnt(masm_, "[ Lookup slot");
5002 Label done, slow; 4974 Label done, slow;
5003 4975
5004 // Generate code for loading from variables potentially shadowed 4976 // Generate code for loading from variables potentially shadowed
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
5364 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(), 5336 DCHECK_EQ(isolate->builtins()->OsrAfterStackCheck()->entry(),
5365 Assembler::target_address_at(call_target_address, 5337 Assembler::target_address_at(call_target_address,
5366 unoptimized_code)); 5338 unoptimized_code));
5367 return OSR_AFTER_STACK_CHECK; 5339 return OSR_AFTER_STACK_CHECK;
5368 } 5340 }
5369 5341
5370 5342
5371 } } // namespace v8::internal 5343 } } // namespace v8::internal
5372 5344
5373 #endif // V8_TARGET_ARCH_X87 5345 #endif // V8_TARGET_ARCH_X87
OLDNEW
« no previous file with comments | « src/x87/debug-x87.cc ('k') | src/x87/lithium-codegen-x87.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698