OLD | NEW |
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 1276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1287 | 1287 |
1288 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { | 1288 void FullCodeGenerator::EmitLoadHomeObject(SuperReference* expr) { |
1289 Comment cnmt(masm_, "[ SuperReference "); | 1289 Comment cnmt(masm_, "[ SuperReference "); |
1290 | 1290 |
1291 __ LoadP(LoadDescriptor::ReceiverRegister(), | 1291 __ LoadP(LoadDescriptor::ReceiverRegister(), |
1292 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1292 MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
1293 | 1293 |
1294 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); | 1294 Handle<Symbol> home_object_symbol(isolate()->heap()->home_object_symbol()); |
1295 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); | 1295 __ Move(LoadDescriptor::NameRegister(), home_object_symbol); |
1296 | 1296 |
1297 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1297 __ mov(LoadDescriptor::SlotRegister(), |
1298 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); | 1298 Operand(SmiFromSlot(expr->HomeObjectFeedbackSlot()))); |
1299 CallLoadIC(NOT_CONTEXTUAL); | 1299 CallLoadIC(NOT_CONTEXTUAL); |
1300 | 1300 |
1301 __ Cmpi(r3, Operand(isolate()->factory()->undefined_value()), r0); | 1301 __ Cmpi(r3, Operand(isolate()->factory()->undefined_value()), r0); |
1302 Label done; | 1302 Label done; |
1303 __ bne(&done); | 1303 __ bne(&done); |
1304 __ CallRuntime(Runtime::kThrowNonMethodError, 0); | 1304 __ CallRuntime(Runtime::kThrowNonMethodError, 0); |
1305 __ bind(&done); | 1305 __ bind(&done); |
1306 } | 1306 } |
1307 | 1307 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 __ cmpi(temp, Operand::Zero()); | 1362 __ cmpi(temp, Operand::Zero()); |
1363 __ bne(slow); | 1363 __ bne(slow); |
1364 // Load next context in chain. | 1364 // Load next context in chain. |
1365 __ LoadP(next, ContextOperand(next, Context::PREVIOUS_INDEX)); | 1365 __ LoadP(next, ContextOperand(next, Context::PREVIOUS_INDEX)); |
1366 __ b(&loop); | 1366 __ b(&loop); |
1367 __ bind(&fast); | 1367 __ bind(&fast); |
1368 } | 1368 } |
1369 | 1369 |
1370 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1370 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1371 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); | 1371 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->var()->name())); |
1372 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1372 __ mov(LoadDescriptor::SlotRegister(), |
1373 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1373 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1374 | 1374 |
1375 ContextualMode mode = | 1375 ContextualMode mode = |
1376 (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL : CONTEXTUAL; | 1376 (typeof_state == INSIDE_TYPEOF) ? NOT_CONTEXTUAL : CONTEXTUAL; |
1377 CallLoadIC(mode); | 1377 CallLoadIC(mode); |
1378 } | 1378 } |
1379 | 1379 |
1380 | 1380 |
1381 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, | 1381 MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
1382 Label* slow) { | 1382 Label* slow) { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1448 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); | 1448 PrepareForBailoutForId(proxy->BeforeId(), NO_REGISTERS); |
1449 Variable* var = proxy->var(); | 1449 Variable* var = proxy->var(); |
1450 | 1450 |
1451 // Three cases: global variables, lookup variables, and all other types of | 1451 // Three cases: global variables, lookup variables, and all other types of |
1452 // variables. | 1452 // variables. |
1453 switch (var->location()) { | 1453 switch (var->location()) { |
1454 case Variable::UNALLOCATED: { | 1454 case Variable::UNALLOCATED: { |
1455 Comment cmnt(masm_, "[ Global variable"); | 1455 Comment cmnt(masm_, "[ Global variable"); |
1456 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 1456 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
1457 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); | 1457 __ mov(LoadDescriptor::NameRegister(), Operand(var->name())); |
1458 __ mov(VectorLoadICDescriptor::SlotRegister(), | 1458 __ mov(LoadDescriptor::SlotRegister(), |
1459 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 1459 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
1460 CallGlobalLoadIC(var->name()); | 1460 CallGlobalLoadIC(var->name()); |
1461 context()->Plug(r3); | 1461 context()->Plug(r3); |
1462 break; | 1462 break; |
1463 } | 1463 } |
1464 | 1464 |
1465 case Variable::PARAMETER: | 1465 case Variable::PARAMETER: |
1466 case Variable::LOCAL: | 1466 case Variable::LOCAL: |
1467 case Variable::CONTEXT: { | 1467 case Variable::CONTEXT: { |
1468 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" | 1468 Comment cmnt(masm_, var->IsContextSlot() ? "[ Context variable" |
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2141 __ bind(&l_next); | 2141 __ bind(&l_next); |
2142 | 2142 |
2143 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" | 2143 __ LoadRoot(load_name, Heap::knext_stringRootIndex); // "next" |
2144 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); // iter | 2144 __ LoadP(r6, MemOperand(sp, 1 * kPointerSize)); // iter |
2145 __ Push(load_name, r6, r3); // "next", iter, received | 2145 __ Push(load_name, r6, r3); // "next", iter, received |
2146 | 2146 |
2147 // result = receiver[f](arg); | 2147 // result = receiver[f](arg); |
2148 __ bind(&l_call); | 2148 __ bind(&l_call); |
2149 __ LoadP(load_receiver, MemOperand(sp, kPointerSize)); | 2149 __ LoadP(load_receiver, MemOperand(sp, kPointerSize)); |
2150 __ LoadP(load_name, MemOperand(sp, 2 * kPointerSize)); | 2150 __ LoadP(load_name, MemOperand(sp, 2 * kPointerSize)); |
2151 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2151 __ mov(LoadDescriptor::SlotRegister(), |
2152 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); | 2152 Operand(SmiFromSlot(expr->KeyedLoadFeedbackSlot()))); |
2153 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2153 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2154 CallIC(ic, TypeFeedbackId::None()); | 2154 CallIC(ic, TypeFeedbackId::None()); |
2155 __ mr(r4, r3); | 2155 __ mr(r4, r3); |
2156 __ StoreP(r4, MemOperand(sp, 2 * kPointerSize)); | 2156 __ StoreP(r4, MemOperand(sp, 2 * kPointerSize)); |
2157 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); | 2157 CallFunctionStub stub(isolate(), 1, CALL_AS_METHOD); |
2158 __ CallStub(&stub); | 2158 __ CallStub(&stub); |
2159 | 2159 |
2160 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); | 2160 __ LoadP(cp, MemOperand(fp, StandardFrameConstants::kContextOffset)); |
2161 __ Drop(1); // The function is still on the stack; drop it. | 2161 __ Drop(1); // The function is still on the stack; drop it. |
2162 | 2162 |
2163 // if (!result.done) goto l_try; | 2163 // if (!result.done) goto l_try; |
2164 __ Move(load_receiver, r3); | 2164 __ Move(load_receiver, r3); |
2165 | 2165 |
2166 __ push(load_receiver); // save result | 2166 __ push(load_receiver); // save result |
2167 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" | 2167 __ LoadRoot(load_name, Heap::kdone_stringRootIndex); // "done" |
2168 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2168 __ mov(LoadDescriptor::SlotRegister(), |
2169 Operand(SmiFromSlot(expr->DoneFeedbackSlot()))); | 2169 Operand(SmiFromSlot(expr->DoneFeedbackSlot()))); |
2170 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done | 2170 CallLoadIC(NOT_CONTEXTUAL); // r0=result.done |
2171 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); | 2171 Handle<Code> bool_ic = ToBooleanStub::GetUninitialized(isolate()); |
2172 CallIC(bool_ic); | 2172 CallIC(bool_ic); |
2173 __ cmpi(r3, Operand::Zero()); | 2173 __ cmpi(r3, Operand::Zero()); |
2174 __ beq(&l_try); | 2174 __ beq(&l_try); |
2175 | 2175 |
2176 // result.value | 2176 // result.value |
2177 __ pop(load_receiver); // result | 2177 __ pop(load_receiver); // result |
2178 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" | 2178 __ LoadRoot(load_name, Heap::kvalue_stringRootIndex); // "value" |
2179 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2179 __ mov(LoadDescriptor::SlotRegister(), |
2180 Operand(SmiFromSlot(expr->ValueFeedbackSlot()))); | 2180 Operand(SmiFromSlot(expr->ValueFeedbackSlot()))); |
2181 CallLoadIC(NOT_CONTEXTUAL); // r3=result.value | 2181 CallLoadIC(NOT_CONTEXTUAL); // r3=result.value |
2182 context()->DropAndPlug(2, r3); // drop iter and g | 2182 context()->DropAndPlug(2, r3); // drop iter and g |
2183 break; | 2183 break; |
2184 } | 2184 } |
2185 } | 2185 } |
2186 } | 2186 } |
2187 | 2187 |
2188 | 2188 |
2189 void FullCodeGenerator::EmitGeneratorResume( | 2189 void FullCodeGenerator::EmitGeneratorResume( |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2326 kLRHasBeenSaved, kDontSaveFPRegs); | 2326 kLRHasBeenSaved, kDontSaveFPRegs); |
2327 } | 2327 } |
2328 | 2328 |
2329 | 2329 |
2330 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { | 2330 void FullCodeGenerator::EmitNamedPropertyLoad(Property* prop) { |
2331 SetSourcePosition(prop->position()); | 2331 SetSourcePosition(prop->position()); |
2332 Literal* key = prop->key()->AsLiteral(); | 2332 Literal* key = prop->key()->AsLiteral(); |
2333 DCHECK(!prop->IsSuperAccess()); | 2333 DCHECK(!prop->IsSuperAccess()); |
2334 | 2334 |
2335 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); | 2335 __ mov(LoadDescriptor::NameRegister(), Operand(key->value())); |
2336 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2336 __ mov(LoadDescriptor::SlotRegister(), |
2337 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2337 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2338 CallLoadIC(NOT_CONTEXTUAL); | 2338 CallLoadIC(NOT_CONTEXTUAL); |
2339 } | 2339 } |
2340 | 2340 |
2341 | 2341 |
2342 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { | 2342 void FullCodeGenerator::EmitNamedSuperPropertyLoad(Property* prop) { |
2343 // Stack: receiver, home_object. | 2343 // Stack: receiver, home_object. |
2344 SetSourcePosition(prop->position()); | 2344 SetSourcePosition(prop->position()); |
2345 Literal* key = prop->key()->AsLiteral(); | 2345 Literal* key = prop->key()->AsLiteral(); |
2346 DCHECK(!key->value()->IsSmi()); | 2346 DCHECK(!key->value()->IsSmi()); |
2347 DCHECK(prop->IsSuperAccess()); | 2347 DCHECK(prop->IsSuperAccess()); |
2348 | 2348 |
2349 __ Push(key->value()); | 2349 __ Push(key->value()); |
2350 __ CallRuntime(Runtime::kLoadFromSuper, 3); | 2350 __ CallRuntime(Runtime::kLoadFromSuper, 3); |
2351 } | 2351 } |
2352 | 2352 |
2353 | 2353 |
2354 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { | 2354 void FullCodeGenerator::EmitKeyedPropertyLoad(Property* prop) { |
2355 SetSourcePosition(prop->position()); | 2355 SetSourcePosition(prop->position()); |
2356 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); | 2356 Handle<Code> ic = CodeFactory::KeyedLoadIC(isolate()).code(); |
2357 __ mov(VectorLoadICDescriptor::SlotRegister(), | 2357 __ mov(LoadDescriptor::SlotRegister(), |
2358 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); | 2358 Operand(SmiFromSlot(prop->PropertyFeedbackSlot()))); |
2359 CallIC(ic); | 2359 CallIC(ic); |
2360 } | 2360 } |
2361 | 2361 |
2362 | 2362 |
2363 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { | 2363 void FullCodeGenerator::EmitKeyedSuperPropertyLoad(Property* prop) { |
2364 // Stack: receiver, home_object, key. | 2364 // Stack: receiver, home_object, key. |
2365 SetSourcePosition(prop->position()); | 2365 SetSourcePosition(prop->position()); |
2366 | 2366 |
2367 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); | 2367 __ CallRuntime(Runtime::kLoadKeyedFromSuper, 3); |
(...skipping 2251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4619 | 4619 |
4620 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { | 4620 void FullCodeGenerator::EmitLoadJSRuntimeFunction(CallRuntime* expr) { |
4621 // Push the builtins object as the receiver. | 4621 // Push the builtins object as the receiver. |
4622 Register receiver = LoadDescriptor::ReceiverRegister(); | 4622 Register receiver = LoadDescriptor::ReceiverRegister(); |
4623 __ LoadP(receiver, GlobalObjectOperand()); | 4623 __ LoadP(receiver, GlobalObjectOperand()); |
4624 __ LoadP(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); | 4624 __ LoadP(receiver, FieldMemOperand(receiver, GlobalObject::kBuiltinsOffset)); |
4625 __ push(receiver); | 4625 __ push(receiver); |
4626 | 4626 |
4627 // Load the function from the receiver. | 4627 // Load the function from the receiver. |
4628 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); | 4628 __ mov(LoadDescriptor::NameRegister(), Operand(expr->name())); |
4629 __ mov(VectorLoadICDescriptor::SlotRegister(), | 4629 __ mov(LoadDescriptor::SlotRegister(), |
4630 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); | 4630 Operand(SmiFromSlot(expr->CallRuntimeFeedbackSlot()))); |
4631 CallLoadIC(NOT_CONTEXTUAL); | 4631 CallLoadIC(NOT_CONTEXTUAL); |
4632 } | 4632 } |
4633 | 4633 |
4634 | 4634 |
4635 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { | 4635 void FullCodeGenerator::EmitCallJSRuntimeFunction(CallRuntime* expr) { |
4636 ZoneList<Expression*>* args = expr->arguments(); | 4636 ZoneList<Expression*>* args = expr->arguments(); |
4637 int arg_count = args->length(); | 4637 int arg_count = args->length(); |
4638 | 4638 |
4639 // Record source position of the IC call. | 4639 // Record source position of the IC call. |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5050 | 5050 |
5051 | 5051 |
5052 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { | 5052 void FullCodeGenerator::VisitForTypeofValue(Expression* expr) { |
5053 DCHECK(!context()->IsEffect()); | 5053 DCHECK(!context()->IsEffect()); |
5054 DCHECK(!context()->IsTest()); | 5054 DCHECK(!context()->IsTest()); |
5055 VariableProxy* proxy = expr->AsVariableProxy(); | 5055 VariableProxy* proxy = expr->AsVariableProxy(); |
5056 if (proxy != NULL && proxy->var()->IsUnallocated()) { | 5056 if (proxy != NULL && proxy->var()->IsUnallocated()) { |
5057 Comment cmnt(masm_, "[ Global variable"); | 5057 Comment cmnt(masm_, "[ Global variable"); |
5058 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); | 5058 __ LoadP(LoadDescriptor::ReceiverRegister(), GlobalObjectOperand()); |
5059 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); | 5059 __ mov(LoadDescriptor::NameRegister(), Operand(proxy->name())); |
5060 __ mov(VectorLoadICDescriptor::SlotRegister(), | 5060 __ mov(LoadDescriptor::SlotRegister(), |
5061 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); | 5061 Operand(SmiFromSlot(proxy->VariableFeedbackSlot()))); |
5062 // Use a regular load, not a contextual load, to avoid a reference | 5062 // Use a regular load, not a contextual load, to avoid a reference |
5063 // error. | 5063 // error. |
5064 CallLoadIC(NOT_CONTEXTUAL); | 5064 CallLoadIC(NOT_CONTEXTUAL); |
5065 PrepareForBailout(expr, TOS_REG); | 5065 PrepareForBailout(expr, TOS_REG); |
5066 context()->Plug(r3); | 5066 context()->Plug(r3); |
5067 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { | 5067 } else if (proxy != NULL && proxy->var()->IsLookupSlot()) { |
5068 Comment cmnt(masm_, "[ Lookup slot"); | 5068 Comment cmnt(masm_, "[ Lookup slot"); |
5069 Label done, slow; | 5069 Label done, slow; |
5070 | 5070 |
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5427 return ON_STACK_REPLACEMENT; | 5427 return ON_STACK_REPLACEMENT; |
5428 } | 5428 } |
5429 | 5429 |
5430 DCHECK(interrupt_address == | 5430 DCHECK(interrupt_address == |
5431 isolate->builtins()->OsrAfterStackCheck()->entry()); | 5431 isolate->builtins()->OsrAfterStackCheck()->entry()); |
5432 return OSR_AFTER_STACK_CHECK; | 5432 return OSR_AFTER_STACK_CHECK; |
5433 } | 5433 } |
5434 } | 5434 } |
5435 } // namespace v8::internal | 5435 } // namespace v8::internal |
5436 #endif // V8_TARGET_ARCH_PPC | 5436 #endif // V8_TARGET_ARCH_PPC |
OLD | NEW |