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

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

Issue 1132513007: PPC: 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/ppc/debug-ppc.cc ('k') | src/ppc/lithium-codegen-ppc.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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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_PPC 7 #if V8_TARGET_ARCH_PPC
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 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after
1286 1286
1287 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { 1287 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) {
1288 Comment cnmt(masm_, "[ SuperReference "); 1288 Comment cnmt(masm_, "[ SuperReference ");
1289 1289
1290 __ LoadP(LoadDescriptor::ReceiverRegister(), 1290 __ LoadP(LoadDescriptor::ReceiverRegister(),
1291 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); 1291 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset));
1292 1292
1293 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); 1293 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol());
1294 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); 1294 __ Move(LoadDescriptor::NameRegister(), home_object_symbol);
1295 1295
1296 if (FLAG_vector_ics) { 1296 __ mov(VectorLoadICDescriptor::SlotRegister(),
1297 __ mov(VectorLoadICDescriptor::SlotRegister(), 1297 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot())));
1298 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); 1298 CallLoadIC(NOT_CONTEXTUAL);
1299 CallLoadIC(NOT_CONTEXTUAL);
1300 } else {
1301 CallLoadIC(NOT_CONTEXTUAL, expr->HomeObjectFeedbackId());
1302 }
1303 1299
1304 __ Cmpi(r3, Operand(isolate()->factory()->undefined_value()), r0); 1300 __ Cmpi(r3, Operand(isolate()->factory()->undefined_value()), r0);
1305 Label done; 1301 Label done;
1306 __ bne(&done); 1302 __ bne(&done);
1307 __ CallRuntime(Runtime::kThrowNonMethodError, 0); 1303 __ CallRuntime(Runtime::kThrowNonMethodError, 0);
1308 __ bind(&done); 1304 __ bind(&done);
1309 } 1305 }
1310 1306
1311 1307
1312 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer, 1308 void FullCodeGenerator::EmitSetHomeObjectIfNeeded(Expression* initializer,
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
1365 __ cmpi(temp, Operand::Zero()); 1361 __ cmpi(temp, Operand::Zero());
1366 __ bne(slow); 1362 __ bne(slow);
1367 // Load next context in chain. 1363 // Load next context in chain.
1368 __ LoadP(next, ContextOperand(next, Context::PREVIOUS_INDEX)); 1364 __ LoadP(next, ContextOperand(next, Context::PREVIOUS_INDEX));
1369 __ b(&loop); 1365 __ b(&loop);
1370 __ bind(&fast); 1366 __ bind(&fast);
1371 } 1367 }
1372 1368
1373 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1369 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1374 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); 1370 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name()));
1375 if (FLAG_vector_ics) { 1371 __ mov(VectorLoadICDescriptor::SlotRegister(),
1376 __ mov(VectorLoadICDescriptor::SlotRegister(), 1372 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1377 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1378 }
1379 1373
1380 ContextualMode mode = 1374 ContextualMode mode =
1381 (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL : CONTEXTUAL; 1375 (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL : CONTEXTUAL;
1382 CallLoadIC(mode); 1376 CallLoadIC(mode);
1383 } 1377 }
1384 1378
1385 1379
1386 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, 1380 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var,
1387 Label* slow) { 1381 Label* slow) {
1388 DCHECK(var->IsContextSlot()); 1382 DCHECK(var->IsContextSlot());
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); 1447 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS);
1454 Variable* var = proxy->var(); 1448 Variable* var = proxy->var();
1455 1449
1456 // Three cases: global variables, lookup variables, and all other types of 1450 // Three cases: global variables, lookup variables, and all other types of
1457 // variables. 1451 // variables.
1458 switch (var->location()) { 1452 switch (var->location()) {
1459 case Variable::UNALLOCATED: { 1453 case Variable::UNALLOCATED: {
1460 Comment cmnt(masm_, "[ Global variable"); 1454 Comment cmnt(masm_, "[ Global variable");
1461 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 1455 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
1462 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); 1456 __ mov(LoadDescriptor::NameRegister(), Operand(var->name()));
1463 if (FLAG_vector_ics) { 1457 __ mov(VectorLoadICDescriptor::SlotRegister(),
1464 __ mov(VectorLoadICDescriptor::SlotRegister(), 1458 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1465 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
1466 }
1467 CallGlobalLoadIC(var->name()); 1459 CallGlobalLoadIC(var->name());
1468 context()->Plug(r3); 1460 context()->Plug(r3);
1469 break; 1461 break;
1470 } 1462 }
1471 1463
1472 case Variable::PARAMETER: 1464 case Variable::PARAMETER:
1473 case Variable::LOCAL: 1465 case Variable::LOCAL:
1474 case Variable::CONTEXT: { 1466 case Variable::CONTEXT: {
1475 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" 1467 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable"
1476 : "[ Stack variable"); 1468 : "[ Stack variable");
(...skipping 671 matching lines...) Expand 10 before | Expand all | Expand 10 after
2148 __ bind(&l_next); 2140 __ bind(&l_next);
2149 2141
2150 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" 2142 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next"
2151 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); // iter 2143 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); // iter
2152 __ Push(load_name, r6, r3); // "next", iter, received 2144 __ Push(load_name, r6, r3); // "next", iter, received
2153 2145
2154 // result = receiver[f](arg); 2146 // result = receiver[f](arg);
2155 __ bind(&l_call); 2147 __ bind(&l_call);
2156 __ LoadP(load_receiver, MemOperand(sp, kPointerSize)); 2148 __ LoadP(load_receiver, MemOperand(sp, kPointerSize));
2157 __ LoadP(load_name, MemOperand(sp, 2 * kPointerSize)); 2149 __ LoadP(load_name, MemOperand(sp, 2 * kPointerSize));
2158 if (FLAG_vector_ics) { 2150 __ mov(VectorLoadICDescriptor::SlotRegister(),
2159 __ mov(VectorLoadICDescriptor::SlotRegister(), 2151 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2160 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot())));
2161 }
2162 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2152 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
2163 CallIC(ic, TypeFeedbackId::None()); 2153 CallIC(ic, TypeFeedbackId::None());
2164 __ mr(r4, r3); 2154 __ mr(r4, r3);
2165 __ StoreP(r4, MemOperand(sp, 2 * kPointerSize)); 2155 __ StoreP(r4, MemOperand(sp, 2 * kPointerSize));
2166 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); 2156 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD);
2167 __ CallStub(&stub); 2157 __ CallStub(&stub);
2168 2158
2169 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); 2159 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset));
2170 __ Drop(1); // The function is still on the stack; drop it. 2160 __ Drop(1); // The function is still on the stack; drop it.
2171 2161
2172 // if (!result.done) goto l_try; 2162 // if (!result.done) goto l_try;
2173 __ Move(load_receiver, r3); 2163 __ Move(load_receiver, r3);
2174 2164
2175 __ push(load_receiver); // save result 2165 __ push(load_receiver); // save result
2176 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" 2166 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done"
2177 if (FLAG_vector_ics) { 2167 __ mov(VectorLoadICDescriptor::SlotRegister(),
2178 __ mov(VectorLoadICDescriptor::SlotRegister(), 2168 Operand(SmiFromSlot(expr->DoneFeedbackSlot())));
2179 Operand(SmiFromSlot(expr->DoneFeedbackSlot())));
2180 }
2181 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done 2169 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done
2182 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); 2170 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate());
2183 CallIC(bool_ic); 2171 CallIC(bool_ic);
2184 __ cmpi(r3, Operand::Zero()); 2172 __ cmpi(r3, Operand::Zero());
2185 __ beq(&l_try); 2173 __ beq(&l_try);
2186 2174
2187 // result.value 2175 // result.value
2188 __ pop(load_receiver); // result 2176 __ pop(load_receiver); // result
2189 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" 2177 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value"
2190 if (FLAG_vector_ics) { 2178 __ mov(VectorLoadICDescriptor::SlotRegister(),
2191 __ mov(VectorLoadICDescriptor::SlotRegister(), 2179 Operand(SmiFromSlot(expr->ValueFeedbackSlot())));
2192 Operand(SmiFromSlot(expr->ValueFeedbackSlot())));
2193 }
2194 CallLoadIC(NOT_CONTEXTUAL); // r3=result.value 2180 CallLoadIC(NOT_CONTEXTUAL); // r3=result.value
2195 context()->DropAndPlug(2, r3); // drop iter and g 2181 context()->DropAndPlug(2, r3); // drop iter and g
2196 break; 2182 break;
2197 } 2183 }
2198 } 2184 }
2199 } 2185 }
2200 2186
2201 2187
2202 void FullCodeGenerator::EmitGeneratorResume( 2188 void FullCodeGenerator::EmitGeneratorResume(
2203 Expression* generator, Expression* value, 2189 Expression* generator, Expression* value,
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
2339 kLRHasBeenSaved, kDontSaveFPRegs); 2325 kLRHasBeenSaved, kDontSaveFPRegs);
2340 } 2326 }
2341 2327
2342 2328
2343 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { 2329 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) {
2344 SetSourcePosition(prop->position()); 2330 SetSourcePosition(prop->position());
2345 Literal* key = prop->key()->AsLiteral(); 2331 Literal* key = prop->key()->AsLiteral();
2346 DCHECK(!prop->IsSuperAccess()); 2332 DCHECK(!prop->IsSuperAccess());
2347 2333
2348 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); 2334 __ mov(LoadDescriptor::NameRegister(), Operand(key->value()));
2349 if (FLAG_vector_ics) { 2335 __ mov(VectorLoadICDescriptor::SlotRegister(),
2350 __ mov(VectorLoadICDescriptor::SlotRegister(), 2336 Operand(SmiFromSlot(prop->PropertyFeedbackSlot())));
2351 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2337 CallLoadIC(NOT_CONTEXTUAL);
2352 CallLoadIC(NOT_CONTEXTUAL);
2353 } else {
2354 CallLoadIC(NOT_CONTEXTUAL, prop->PropertyFeedbackId());
2355 }
2356 } 2338 }
2357 2339
2358 2340
2359 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { 2341 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) {
2360 // Stack: receiver, home_object. 2342 // Stack: receiver, home_object.
2361 SetSourcePosition(prop->position()); 2343 SetSourcePosition(prop->position());
2362 Literal* key = prop->key()->AsLiteral(); 2344 Literal* key = prop->key()->AsLiteral();
2363 DCHECK(!key->value()->IsSmi()); 2345 DCHECK(!key->value()->IsSmi());
2364 DCHECK(prop->IsSuperAccess()); 2346 DCHECK(prop->IsSuperAccess());
2365 2347
2366 __ Push(key->value()); 2348 __ Push(key->value());
2367 __ CallRuntime(Runtime::kLoadFromSuper, 3); 2349 __ CallRuntime(Runtime::kLoadFromSuper, 3);
2368 } 2350 }
2369 2351
2370 2352
2371 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { 2353 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) {
2372 SetSourcePosition(prop->position()); 2354 SetSourcePosition(prop->position());
2373 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); 2355 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code();
2374 if (FLAG_vector_ics) { 2356 __ mov(VectorLoadICDescriptor::SlotRegister(),
2375 __ mov(VectorLoadICDescriptor::SlotRegister(), 2357 Operand(SmiFromSlot(prop->PropertyFeedbackSlot())));
2376 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); 2358 CallIC(ic);
2377 CallIC(ic);
2378 } else {
2379 CallIC(ic, prop->PropertyFeedbackId());
2380 }
2381 } 2359 }
2382 2360
2383 2361
2384 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { 2362 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) {
2385 // Stack: receiver, home_object, key. 2363 // Stack: receiver, home_object, key.
2386 SetSourcePosition(prop->position()); 2364 SetSourcePosition(prop->position());
2387 2365
2388 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); 2366 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3);
2389 } 2367 }
2390 2368
(...skipping 2248 matching lines...) Expand 10 before | Expand all | Expand 10 after
4639 4617
4640 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { 4618 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) {
4641 // Push the builtins object as the receiver. 4619 // Push the builtins object as the receiver.
4642 Register receiver = LoadDescriptor::ReceiverRegister(); 4620 Register receiver = LoadDescriptor::ReceiverRegister();
4643 __ LoadP(receiver, GlobalObjectOperand()); 4621 __ LoadP(receiver, GlobalObjectOperand());
4644 __ LoadP(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); 4622 __ LoadP(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset));
4645 __ push(receiver); 4623 __ push(receiver);
4646 4624
4647 // Load the function from the receiver. 4625 // Load the function from the receiver.
4648 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); 4626 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name()));
4649 if (FLAG_vector_ics) { 4627 __ mov(VectorLoadICDescriptor::SlotRegister(),
4650 __ mov(VectorLoadICDescriptor::SlotRegister(), 4628 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot())));
4651 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); 4629 CallLoadIC(NOT_CONTEXTUAL);
4652 CallLoadIC(NOT_CONTEXTUAL);
4653 } else {
4654 CallLoadIC(NOT_CONTEXTUAL, expr->CallRuntimeFeedbackId());
4655 }
4656 } 4630 }
4657 4631
4658 4632
4659 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { 4633 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) {
4660 ZoneList<Expression*>* args = expr->arguments(); 4634 ZoneList<Expression*>* args = expr->arguments();
4661 int arg_count = args->length(); 4635 int arg_count = args->length();
4662 4636
4663 // Record source position of the IC call. 4637 // Record source position of the IC call.
4664 SetSourcePosition(expr->position()); 4638 SetSourcePosition(expr->position());
4665 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS); 4639 CallFunctionStub stub(isolate(), arg_count, NO_CALL_FUNCTION_FLAGS);
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
5074 5048
5075 5049
5076 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { 5050 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) {
5077 DCHECK(!context()->IsEffect()); 5051 DCHECK(!context()->IsEffect());
5078 DCHECK(!context()->IsTest()); 5052 DCHECK(!context()->IsTest());
5079 VariableProxy* proxy = expr->AsVariableProxy(); 5053 VariableProxy* proxy = expr->AsVariableProxy();
5080 if (proxy != NULL && proxy->var()->IsUnallocated()) { 5054 if (proxy != NULL && proxy->var()->IsUnallocated()) {
5081 Comment cmnt(masm_, "[ Global variable"); 5055 Comment cmnt(masm_, "[ Global variable");
5082 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); 5056 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand());
5083 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); 5057 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->name()));
5084 if (FLAG_vector_ics) { 5058 __ mov(VectorLoadICDescriptor::SlotRegister(),
5085 __ mov(VectorLoadICDescriptor::SlotRegister(), 5059 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
5086 Operand(SmiFromSlot(proxy->VariableFeedbackSlot())));
5087 }
5088 // Use a regular load, not a contextual load, to avoid a reference 5060 // Use a regular load, not a contextual load, to avoid a reference
5089 // error. 5061 // error.
5090 CallLoadIC(NOT_CONTEXTUAL); 5062 CallLoadIC(NOT_CONTEXTUAL);
5091 PrepareForBailout(expr, TOS_REG); 5063 PrepareForBailout(expr, TOS_REG);
5092 context()->Plug(r3); 5064 context()->Plug(r3);
5093 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { 5065 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) {
5094 Comment cmnt(masm_, "[ Lookup slot"); 5066 Comment cmnt(masm_, "[ Lookup slot");
5095 Label done, slow; 5067 Label done, slow;
5096 5068
5097 // Generate code for loading from variables potentially shadowed 5069 // Generate code for loading from variables potentially shadowed
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
5453 return ON_STACK_REPLACEMENT; 5425 return ON_STACK_REPLACEMENT;
5454 } 5426 }
5455 5427
5456 DCHECK(interrupt_address == 5428 DCHECK(interrupt_address ==
5457 isolate->builtins()->OsrAfterStackCheck()->entry()); 5429 isolate->builtins()->OsrAfterStackCheck()->entry());
5458 return OSR_AFTER_STACK_CHECK; 5430 return OSR_AFTER_STACK_CHECK;
5459 } 5431 }
5460 } 5432 }
5461 } // namespace v8::internal 5433 } // namespace v8::internal
5462 #endif // V8_TARGET_ARCH_PPC 5434 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/debug-ppc.cc ('k') | src/ppc/lithium-codegen-ppc.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698