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

Unified Diff: src/full-codegen/ppc/full-codegen-ppc.cc

Issue 1494003004: PPC: [fullcode] Switch passing of new.target to register. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/full-codegen/ppc/full-codegen-ppc.cc
diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc b/src/full-codegen/ppc/full-codegen-ppc.cc
index 68b843081cba9b6bcbadf1dcb8cd9dbf6958ab56..e8014c0d9f132a1c24791006001221bea9b665be 100644
--- a/src/full-codegen/ppc/full-codegen-ppc.cc
+++ b/src/full-codegen/ppc/full-codegen-ppc.cc
@@ -89,6 +89,7 @@ class JumpPatchSite BASE_EMBEDDED {
//
// The live registers are:
// o r4: the JS function object being called (i.e., ourselves)
+// o r6: the new target value
// o cp: our context
// o fp: our caller's frame pointer (aka r31)
// o sp: stack pointer
@@ -187,14 +188,24 @@ void FullCodeGenerator::Generate() {
__ Push(info->scope()->GetScopeInfo(info->isolate()));
__ CallRuntime(Runtime::kNewScriptContext, 2);
PrepareForBailoutForId(BailoutId::ScriptContext(), TOS_REG);
- } else if (slots <= FastNewContextStub::kMaximumSlots) {
- FastNewContextStub stub(isolate(), slots);
- __ CallStub(&stub);
- // Result of FastNewContextStub is always in new space.
- need_write_barrier = false;
+ // The new target value is not used, clobbering is safe.
+ DCHECK_NULL(info->scope()->new_target_var());
} else {
- __ push(r4);
- __ CallRuntime(Runtime::kNewFunctionContext, 1);
+ if (info->scope()->new_target_var() != nullptr) {
+ __ push(r6); // Preserve new target.
+ }
+ if (slots <= FastNewContextStub::kMaximumSlots) {
+ FastNewContextStub stub(isolate(), slots);
+ __ CallStub(&stub);
+ // Result of FastNewContextStub is always in new space.
+ need_write_barrier = false;
+ } else {
+ __ push(r4);
+ __ CallRuntime(Runtime::kNewFunctionContext, 1);
+ }
+ if (info->scope()->new_target_var() != nullptr) {
+ __ pop(r6); // Preserve new target.
+ }
}
function_in_register_r4 = false;
// Context is returned in r3. It replaces the context passed to us.
@@ -217,7 +228,7 @@ void FullCodeGenerator::Generate() {
// Update the write barrier.
if (need_write_barrier) {
- __ RecordWriteContextSlot(cp, target.offset(), r3, r6,
+ __ RecordWriteContextSlot(cp, target.offset(), r3, r5,
kLRHasBeenSaved, kDontSaveFPRegs);
} else if (FLAG_debug_code) {
Label done;
@@ -228,11 +239,11 @@ void FullCodeGenerator::Generate() {
}
}
}
- PrepareForBailoutForId(BailoutId::FunctionContext(), NO_REGISTERS);
- // Function register is trashed in case we bailout here. But since that
- // could happen only when we allocate a context the value of
- // |function_in_register_r4| is correct.
+ // Register holding this function and new target are both trashed in case we
+ // bailout here. But since that can happen only when new target is not used
+ // and we allocate a context, the value of |function_in_register| is correct.
+ PrepareForBailoutForId(BailoutId::FunctionContext(), NO_REGISTERS);
// Possibly set up a local binding to the this function which is used in
// derived constructors with super calls.
@@ -246,36 +257,11 @@ void FullCodeGenerator::Generate() {
SetVar(this_function_var, r4, r3, r5);
}
+ // Possibly set up a local binding to the new target value.
Variable* new_target_var = scope()->new_target_var();
if (new_target_var != nullptr) {
Comment cmnt(masm_, "[ new.target");
-
- // Get the frame pointer for the calling frame.
- __ LoadP(r5, MemOperand(fp, StandardFrameConstants::kCallerFPOffset));
-
- // Skip the arguments adaptor frame if it exists.
- __ LoadP(r4, MemOperand(r5, StandardFrameConstants::kContextOffset));
- __ CmpSmiLiteral(r4, Smi::FromInt(StackFrame::ARGUMENTS_ADAPTOR), r0);
- Label skip;
- __ bne(&skip);
- __ LoadP(r5, MemOperand(r5, StandardFrameConstants::kCallerFPOffset));
- __ bind(&skip);
-
- // Check the marker in the calling frame.
- __ LoadP(r4, MemOperand(r5, StandardFrameConstants::kMarkerOffset));
- __ CmpSmiLiteral(r4, Smi::FromInt(StackFrame::CONSTRUCT), r0);
- Label non_construct_frame, done;
- function_in_register_r4 = false;
-
- __ bne(&non_construct_frame);
- __ LoadP(r3, MemOperand(r5, ConstructFrameConstants::kNewTargetOffset));
- __ b(&done);
-
- __ bind(&non_construct_frame);
- __ LoadRoot(r3, Heap::kUndefinedValueRootIndex);
- __ bind(&done);
-
- SetVar(new_target_var, r3, r5, r6);
+ SetVar(new_target_var, r6, r3, r5);
}
Variable* arguments = scope()->arguments();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698