| 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 #if V8_TARGET_ARCH_PPC | 5 #if V8_TARGET_ARCH_PPC |
| 6 | 6 |
| 7 #include "src/full-codegen/full-codegen.h" | |
| 8 #include "src/ast/compile-time-value.h" | 7 #include "src/ast/compile-time-value.h" |
| 9 #include "src/ast/scopes.h" | 8 #include "src/ast/scopes.h" |
| 9 #include "src/builtins/builtins-constructor.h" |
| 10 #include "src/code-factory.h" | 10 #include "src/code-factory.h" |
| 11 #include "src/code-stubs.h" | 11 #include "src/code-stubs.h" |
| 12 #include "src/codegen.h" | 12 #include "src/codegen.h" |
| 13 #include "src/compilation-info.h" | 13 #include "src/compilation-info.h" |
| 14 #include "src/compiler.h" | 14 #include "src/compiler.h" |
| 15 #include "src/debug/debug.h" | 15 #include "src/debug/debug.h" |
| 16 #include "src/full-codegen/full-codegen.h" |
| 16 #include "src/ic/ic.h" | 17 #include "src/ic/ic.h" |
| 17 | 18 |
| 18 #include "src/ppc/code-stubs-ppc.h" | 19 #include "src/ppc/code-stubs-ppc.h" |
| 19 #include "src/ppc/macro-assembler-ppc.h" | 20 #include "src/ppc/macro-assembler-ppc.h" |
| 20 | 21 |
| 21 namespace v8 { | 22 namespace v8 { |
| 22 namespace internal { | 23 namespace internal { |
| 23 | 24 |
| 24 #define __ ACCESS_MASM(masm()) | 25 #define __ ACCESS_MASM(masm()) |
| 25 | 26 |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 __ Push(info->scope()->scope_info()); | 200 __ Push(info->scope()->scope_info()); |
| 200 __ CallRuntime(Runtime::kNewScriptContext); | 201 __ CallRuntime(Runtime::kNewScriptContext); |
| 201 PrepareForBailoutForId(BailoutId::ScriptContext(), | 202 PrepareForBailoutForId(BailoutId::ScriptContext(), |
| 202 BailoutState::TOS_REGISTER); | 203 BailoutState::TOS_REGISTER); |
| 203 // The new target value is not used, clobbering is safe. | 204 // The new target value is not used, clobbering is safe. |
| 204 DCHECK_NULL(info->scope()->new_target_var()); | 205 DCHECK_NULL(info->scope()->new_target_var()); |
| 205 } else { | 206 } else { |
| 206 if (info->scope()->new_target_var() != nullptr) { | 207 if (info->scope()->new_target_var() != nullptr) { |
| 207 __ push(r6); // Preserve new target. | 208 __ push(r6); // Preserve new target. |
| 208 } | 209 } |
| 209 if (slots <= FastNewFunctionContextStub::MaximumSlots()) { | 210 if (slots <= |
| 210 FastNewFunctionContextStub stub(isolate(), info->scope()->scope_type()); | 211 ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) { |
| 212 Callable callable = CodeFactory::FastNewFunctionContext( |
| 213 isolate(), info->scope()->scope_type()); |
| 211 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), | 214 __ mov(FastNewFunctionContextDescriptor::SlotsRegister(), |
| 212 Operand(slots)); | 215 Operand(slots)); |
| 213 __ CallStub(&stub); | 216 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
| 214 // Result of FastNewFunctionContextStub is always in new space. | 217 // Result of the FastNewFunctionContext builtin is always in new space. |
| 215 need_write_barrier = false; | 218 need_write_barrier = false; |
| 216 } else { | 219 } else { |
| 217 __ push(r4); | 220 __ push(r4); |
| 218 __ Push(Smi::FromInt(info->scope()->scope_type())); | 221 __ Push(Smi::FromInt(info->scope()->scope_type())); |
| 219 __ CallRuntime(Runtime::kNewFunctionContext); | 222 __ CallRuntime(Runtime::kNewFunctionContext); |
| 220 } | 223 } |
| 221 if (info->scope()->new_target_var() != nullptr) { | 224 if (info->scope()->new_target_var() != nullptr) { |
| 222 __ pop(r6); // Preserve new target. | 225 __ pop(r6); // Preserve new target. |
| 223 } | 226 } |
| 224 } | 227 } |
| (...skipping 954 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1179 Handle<FixedArray> constant_properties = expr->constant_properties(); | 1182 Handle<FixedArray> constant_properties = expr->constant_properties(); |
| 1180 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1183 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1181 __ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index())); | 1184 __ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index())); |
| 1182 __ mov(r4, Operand(constant_properties)); | 1185 __ mov(r4, Operand(constant_properties)); |
| 1183 int flags = expr->ComputeFlags(); | 1186 int flags = expr->ComputeFlags(); |
| 1184 __ LoadSmiLiteral(r3, Smi::FromInt(flags)); | 1187 __ LoadSmiLiteral(r3, Smi::FromInt(flags)); |
| 1185 if (MustCreateObjectLiteralWithRuntime(expr)) { | 1188 if (MustCreateObjectLiteralWithRuntime(expr)) { |
| 1186 __ Push(r6, r5, r4, r3); | 1189 __ Push(r6, r5, r4, r3); |
| 1187 __ CallRuntime(Runtime::kCreateObjectLiteral); | 1190 __ CallRuntime(Runtime::kCreateObjectLiteral); |
| 1188 } else { | 1191 } else { |
| 1189 FastCloneShallowObjectStub stub(isolate(), expr->properties_count()); | 1192 Callable callable = CodeFactory::FastCloneShallowObject( |
| 1190 __ CallStub(&stub); | 1193 isolate(), expr->properties_count()); |
| 1194 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
| 1191 RestoreContext(); | 1195 RestoreContext(); |
| 1192 } | 1196 } |
| 1193 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1197 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
| 1194 | 1198 |
| 1195 // If result_saved is true the result is on top of the stack. If | 1199 // If result_saved is true the result is on top of the stack. If |
| 1196 // result_saved is false the result is in r3. | 1200 // result_saved is false the result is in r3. |
| 1197 bool result_saved = false; | 1201 bool result_saved = false; |
| 1198 | 1202 |
| 1199 AccessorTable accessor_table(zone()); | 1203 AccessorTable accessor_table(zone()); |
| 1200 for (int i = 0; i < expr->properties()->length(); i++) { | 1204 for (int i = 0; i < expr->properties()->length(); i++) { |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1315 } | 1319 } |
| 1316 | 1320 |
| 1317 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); | 1321 __ LoadP(r6, MemOperand(fp, JavaScriptFrameConstants::kFunctionOffset)); |
| 1318 __ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index())); | 1322 __ LoadSmiLiteral(r5, Smi::FromInt(expr->literal_index())); |
| 1319 __ mov(r4, Operand(constant_elements)); | 1323 __ mov(r4, Operand(constant_elements)); |
| 1320 if (MustCreateArrayLiteralWithRuntime(expr)) { | 1324 if (MustCreateArrayLiteralWithRuntime(expr)) { |
| 1321 __ LoadSmiLiteral(r3, Smi::FromInt(expr->ComputeFlags())); | 1325 __ LoadSmiLiteral(r3, Smi::FromInt(expr->ComputeFlags())); |
| 1322 __ Push(r6, r5, r4, r3); | 1326 __ Push(r6, r5, r4, r3); |
| 1323 __ CallRuntime(Runtime::kCreateArrayLiteral); | 1327 __ CallRuntime(Runtime::kCreateArrayLiteral); |
| 1324 } else { | 1328 } else { |
| 1325 FastCloneShallowArrayStub stub(isolate(), allocation_site_mode); | 1329 Callable callable = |
| 1326 __ CallStub(&stub); | 1330 CodeFactory::FastCloneShallowArray(isolate(), allocation_site_mode); |
| 1331 __ Call(callable.code(), RelocInfo::CODE_TARGET); |
| 1327 RestoreContext(); | 1332 RestoreContext(); |
| 1328 } | 1333 } |
| 1329 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); | 1334 PrepareForBailoutForId(expr->CreateLiteralId(), BailoutState::TOS_REGISTER); |
| 1330 | 1335 |
| 1331 bool result_saved = false; // Is the result saved to the stack? | 1336 bool result_saved = false; // Is the result saved to the stack? |
| 1332 ZoneList<Expression*>* subexprs = expr->values(); | 1337 ZoneList<Expression*>* subexprs = expr->values(); |
| 1333 int length = subexprs->length(); | 1338 int length = subexprs->length(); |
| 1334 | 1339 |
| 1335 // Emit code to evaluate all the non-constant subexpressions and to store | 1340 // Emit code to evaluate all the non-constant subexpressions and to store |
| 1336 // them into the newly cloned array. | 1341 // them into the newly cloned array. |
| (...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2857 | 2862 |
| 2858 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); | 2863 DCHECK(Assembler::IsCrSet(Assembler::instr_at(cmp_address))); |
| 2859 | 2864 |
| 2860 DCHECK(interrupt_address == | 2865 DCHECK(interrupt_address == |
| 2861 isolate->builtins()->OnStackReplacement()->entry()); | 2866 isolate->builtins()->OnStackReplacement()->entry()); |
| 2862 return ON_STACK_REPLACEMENT; | 2867 return ON_STACK_REPLACEMENT; |
| 2863 } | 2868 } |
| 2864 } // namespace internal | 2869 } // namespace internal |
| 2865 } // namespace v8 | 2870 } // namespace v8 |
| 2866 #endif // V8_TARGET_ARCH_PPC | 2871 #endif // V8_TARGET_ARCH_PPC |
| OLD | NEW |