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

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

Issue 1208443002: PPC: Do not add extra argument for new.target (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 6 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/code-stubs-ppc.cc ('k') | no next file » | 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 236 matching lines...) Expand 10 before | Expand all | Expand 10 after
247 // derived constructors with super calls. 247 // derived constructors with super calls.
248 Variable* this_function_var = scope()->this_function_var(); 248 Variable* this_function_var = scope()->this_function_var();
249 if (this_function_var != nullptr) { 249 if (this_function_var != nullptr) {
250 Comment cmnt(masm_, "[ This function"); 250 Comment cmnt(masm_, "[ This function");
251 SetVar(this_function_var, r4, r3, r5); 251 SetVar(this_function_var, r4, r3, r5);
252 } 252 }
253 253
254 Variable* new_target_var = scope()->new_target_var(); 254 Variable* new_target_var = scope()->new_target_var();
255 if (new_target_var != nullptr) { 255 if (new_target_var != nullptr) {
256 Comment cmnt(masm_, "[ new.target"); 256 Comment cmnt(masm_, "[ new.target");
257 // new.target is parameter -2. 257
258 int offset = 2 * kPointerSize + 258 // Get the frame pointer for the calling frame.
259 (info_->scope()->num_parameters() + 1) * kPointerSize; 259 __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
260 __ LoadP(r3, MemOperand(fp, offset)); 260
261 // Skip the arguments adaptor frame if it exists.
262 __ LoadP(r4, MemOperand(r5, StandardFrameConstants::kContextOffset));
263 __ CmpSmiLiteral(r4, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0);
264 Label skip;
265 __ bne(&skip);
266 __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset));
267 __ bind(&skip);
268
269 // Check the marker in the calling frame.
270 __ LoadP(r4, MemOperand(r5, StandardFrameConstants::kMarkerOffset));
271 __ CmpSmiLiteral(r4, Smi::FromInt(StackFrame::CONSTRUCT), r0);
272 Label non_construct_frame, done;
273
274 __ bne(&non_construct_frame);
275 __ LoadP(r3, MemOperand(r5, StandardFrameConstants::kExpressionsOffset -
276 2 * kPointerSize));
277 __ b(&done);
278
279 __ bind(&non_construct_frame);
280 __ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
281 __ bind(&done);
282
261 SetVar(new_target_var, r3, r5, r6); 283 SetVar(new_target_var, r3, r5, r6);
262 } 284 }
263 285
264 ArgumentsAccessStub::HasNewTarget has_new_target =
265 IsSubclassConstructor(info->function()->kind())
266 ? ArgumentsAccessStub::HAS_NEW_TARGET
267 : ArgumentsAccessStub::NO_NEW_TARGET;
268
269 // Possibly allocate RestParameters 286 // Possibly allocate RestParameters
270 int rest_index; 287 int rest_index;
271 Variable* rest_param = scope()->rest_parameter(&rest_index); 288 Variable* rest_param = scope()->rest_parameter(&rest_index);
272 if (rest_param) { 289 if (rest_param) {
273 Comment cmnt(masm_, "[ Allocate rest parameter array"); 290 Comment cmnt(masm_, "[ Allocate rest parameter array");
274 291
275 int num_parameters = info->scope()->num_parameters(); 292 int num_parameters = info->scope()->num_parameters();
276 int offset = num_parameters * kPointerSize; 293 int offset = num_parameters * kPointerSize;
277 if (has_new_target == ArgumentsAccessStub::HAS_NEW_TARGET) {
278 --num_parameters;
279 ++rest_index;
280 }
281 294
282 __ addi(r6, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset)); 295 __ addi(r6, fp, Operand(StandardFrameConstants::kCallerSPOffset + offset));
283 __ LoadSmiLiteral(r5, Smi::FromInt(num_parameters)); 296 __ LoadSmiLiteral(r5, Smi::FromInt(num_parameters));
284 __ LoadSmiLiteral(r4, Smi::FromInt(rest_index)); 297 __ LoadSmiLiteral(r4, Smi::FromInt(rest_index));
285 __ LoadSmiLiteral(r3, Smi::FromInt(language_mode())); 298 __ LoadSmiLiteral(r3, Smi::FromInt(language_mode()));
286 __ Push(r6, r5, r4, r3); 299 __ Push(r6, r5, r4, r3);
287 300
288 RestParamAccessStub stub(isolate()); 301 RestParamAccessStub stub(isolate());
289 __ CallStub(&stub); 302 __ CallStub(&stub);
290 303
(...skipping 22 matching lines...) Expand all
313 // The stub will rewrite receiever and parameter count if the previous 326 // The stub will rewrite receiever and parameter count if the previous
314 // stack frame was an arguments adapter frame. 327 // stack frame was an arguments adapter frame.
315 ArgumentsAccessStub::Type type; 328 ArgumentsAccessStub::Type type;
316 if (is_strict(language_mode()) || !is_simple_parameter_list()) { 329 if (is_strict(language_mode()) || !is_simple_parameter_list()) {
317 type = ArgumentsAccessStub::NEW_STRICT; 330 type = ArgumentsAccessStub::NEW_STRICT;
318 } else if (function()->has_duplicate_parameters()) { 331 } else if (function()->has_duplicate_parameters()) {
319 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW; 332 type = ArgumentsAccessStub::NEW_SLOPPY_SLOW;
320 } else { 333 } else {
321 type = ArgumentsAccessStub::NEW_SLOPPY_FAST; 334 type = ArgumentsAccessStub::NEW_SLOPPY_FAST;
322 } 335 }
323 ArgumentsAccessStub stub(isolate(), type, has_new_target); 336 ArgumentsAccessStub stub(isolate(), type);
324 __ CallStub(&stub); 337 __ CallStub(&stub);
325 338
326 SetVar(arguments, r3, r4, r5); 339 SetVar(arguments, r3, r4, r5);
327 } 340 }
328 341
329 if (FLAG_trace) { 342 if (FLAG_trace) {
330 __ CallRuntime(Runtime::kTraceEnter, 0); 343 __ CallRuntime(Runtime::kTraceEnter, 0);
331 } 344 }
332 345
333 // Visit the declarations and body unless there is an illegal 346 // Visit the declarations and body unless there is an illegal
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 #ifdef DEBUG 490 #ifdef DEBUG
478 // Add a label for checking the size of the code used for returning. 491 // Add a label for checking the size of the code used for returning.
479 Label check_exit_codesize; 492 Label check_exit_codesize;
480 __ bind(&check_exit_codesize); 493 __ bind(&check_exit_codesize);
481 #endif 494 #endif
482 // Make sure that the constant pool is not emitted inside of the return 495 // Make sure that the constant pool is not emitted inside of the return
483 // sequence. 496 // sequence.
484 { 497 {
485 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_); 498 Assembler::BlockTrampolinePoolScope block_trampoline_pool(masm_);
486 int32_t arg_count = info_->scope()->num_parameters() + 1; 499 int32_t arg_count = info_->scope()->num_parameters() + 1;
487 if (IsSubclassConstructor(info_->function()->kind())) {
488 arg_count++;
489 }
490 int32_t sp_delta = arg_count * kPointerSize; 500 int32_t sp_delta = arg_count * kPointerSize;
491 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1); 501 CodeGenerator::RecordPositions(masm_, function()->end_position() - 1);
492 __ RecordJSReturn(); 502 __ RecordJSReturn();
493 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta); 503 int no_frame_start = __ LeaveFrame(StackFrame::JAVA_SCRIPT, sp_delta);
494 #if V8_TARGET_ARCH_PPC64 504 #if V8_TARGET_ARCH_PPC64
495 // With 64bit we may need nop() instructions to ensure we have 505 // With 64bit we may need nop() instructions to ensure we have
496 // enough space to SetDebugBreakAtReturn() 506 // enough space to SetDebugBreakAtReturn()
497 if (is_int16(sp_delta)) { 507 if (is_int16(sp_delta)) {
498 if (!FLAG_enable_embedded_constant_pool) masm_->nop(); 508 if (!FLAG_enable_embedded_constant_pool) masm_->nop();
499 masm_->nop(); 509 masm_->nop();
(...skipping 3779 matching lines...) Expand 10 before | Expand all | Expand 10 after
4279 // default constructor has no arguments, so no adaptor frame means no args. 4289 // default constructor has no arguments, so no adaptor frame means no args.
4280 __ li(r3, Operand::Zero()); 4290 __ li(r3, Operand::Zero());
4281 __ b(&args_set_up); 4291 __ b(&args_set_up);
4282 4292
4283 // Copy arguments from adaptor frame. 4293 // Copy arguments from adaptor frame.
4284 { 4294 {
4285 __ bind(&adaptor_frame); 4295 __ bind(&adaptor_frame);
4286 __ LoadP(r3, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset)); 4296 __ LoadP(r3, MemOperand(r5, ArgumentsAdaptorFrameConstants::kLengthOffset));
4287 __ SmiUntag(r3); 4297 __ SmiUntag(r3);
4288 4298
4289 // Subtract 1 from arguments count, for new.target.
4290 __ subi(r3, r3, Operand(1));
4291
4292 // Get arguments pointer in r5. 4299 // Get arguments pointer in r5.
4293 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2)); 4300 __ ShiftLeftImm(r0, r3, Operand(kPointerSizeLog2));
4294 __ add(r5, r5, r0); 4301 __ add(r5, r5, r0);
4295 __ addi(r5, r5, Operand(StandardFrameConstants::kCallerSPOffset)); 4302 __ addi(r5, r5, Operand(StandardFrameConstants::kCallerSPOffset));
4296 4303
4297 Label loop; 4304 Label loop;
4298 __ mtctr(r3); 4305 __ mtctr(r3);
4299 __ bind(&loop); 4306 __ bind(&loop);
4300 // Pre-decrement in order to skip receiver. 4307 // Pre-decrement in order to skip receiver.
4301 __ LoadPU(r6, MemOperand(r5, -kPointerSize)); 4308 __ LoadPU(r6, MemOperand(r5, -kPointerSize));
(...skipping 1258 matching lines...) Expand 10 before | Expand all | Expand 10 after
5560 return ON_STACK_REPLACEMENT; 5567 return ON_STACK_REPLACEMENT;
5561 } 5568 }
5562 5569
5563 DCHECK(interrupt_address == 5570 DCHECK(interrupt_address ==
5564 isolate->builtins()->OsrAfterStackCheck()->entry()); 5571 isolate->builtins()->OsrAfterStackCheck()->entry());
5565 return OSR_AFTER_STACK_CHECK; 5572 return OSR_AFTER_STACK_CHECK;
5566 } 5573 }
5567 } // namespace internal 5574 } // namespace internal
5568 } // namespace v8 5575 } // namespace v8
5569 #endif // V8_TARGET_ARCH_PPC 5576 #endif // V8_TARGET_ARCH_PPC
OLDNEW
« no previous file with comments | « src/ppc/code-stubs-ppc.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698