Commit 45e29ac2 authored by mbrandy's avatar mbrandy Committed by Commit bot

PPC: [runtime] Use "the hole" instead of smi 0 as sentinel for context extension.

Port 9e644881

Original commit message:
    This way we avoid the %_IsSmi magic that is required in TurboFan to
    (efficiently) check abitrary context slots for smi 0. Checking against
    "the hole" is common in the AstGraphBuilder and "the hole" is also used
    to mark other context slots as not initialized.

R=bmeurer@chromium.org, joransiu@ca.ibm.com, jyan@ca.ibm.com, michael_dawson@ca.ibm.com
BUG=

Review URL: https://codereview.chromium.org/1491453002

Cr-Commit-Position: refs/heads/master@{#32438}
parent d5a7eb6d
...@@ -1235,10 +1235,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, ...@@ -1235,10 +1235,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
while (s != NULL) { while (s != NULL) {
if (s->num_heap_slots() > 0) { if (s->num_heap_slots() > 0) {
if (s->calls_sloppy_eval()) { if (s->calls_sloppy_eval()) {
// Check that extension is NULL. // Check that extension is "the hole".
__ LoadP(temp, ContextMemOperand(current, Context::EXTENSION_INDEX)); __ LoadP(temp, ContextMemOperand(current, Context::EXTENSION_INDEX));
__ cmpi(temp, Operand::Zero()); __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
__ bne(slow);
} }
// Load next context in chain. // Load next context in chain.
__ LoadP(next, ContextMemOperand(current, Context::PREVIOUS_INDEX)); __ LoadP(next, ContextMemOperand(current, Context::PREVIOUS_INDEX));
...@@ -1262,10 +1261,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, ...@@ -1262,10 +1261,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy,
__ LoadRoot(ip, Heap::kNativeContextMapRootIndex); __ LoadRoot(ip, Heap::kNativeContextMapRootIndex);
__ cmp(temp, ip); __ cmp(temp, ip);
__ beq(&fast); __ beq(&fast);
// Check that extension is NULL. // Check that extension is "the hole".
__ LoadP(temp, ContextMemOperand(next, Context::EXTENSION_INDEX)); __ LoadP(temp, ContextMemOperand(next, Context::EXTENSION_INDEX));
__ cmpi(temp, Operand::Zero()); __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
__ bne(slow);
// Load next context in chain. // Load next context in chain.
__ LoadP(next, ContextMemOperand(next, Context::PREVIOUS_INDEX)); __ LoadP(next, ContextMemOperand(next, Context::PREVIOUS_INDEX));
__ b(&loop); __ b(&loop);
...@@ -1288,20 +1286,18 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, ...@@ -1288,20 +1286,18 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var,
for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) {
if (s->num_heap_slots() > 0) { if (s->num_heap_slots() > 0) {
if (s->calls_sloppy_eval()) { if (s->calls_sloppy_eval()) {
// Check that extension is NULL. // Check that extension is "the hole".
__ LoadP(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); __ LoadP(temp, ContextMemOperand(context, Context::EXTENSION_INDEX));
__ cmpi(temp, Operand::Zero()); __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
__ bne(slow);
} }
__ LoadP(next, ContextMemOperand(context, Context::PREVIOUS_INDEX)); __ LoadP(next, ContextMemOperand(context, Context::PREVIOUS_INDEX));
// Walk the rest of the chain without clobbering cp. // Walk the rest of the chain without clobbering cp.
context = next; context = next;
} }
} }
// Check that last extension is NULL. // Check that last extension is "the hole".
__ LoadP(temp, ContextMemOperand(context, Context::EXTENSION_INDEX)); __ LoadP(temp, ContextMemOperand(context, Context::EXTENSION_INDEX));
__ cmpi(temp, Operand::Zero()); __ JumpIfNotRoot(temp, Heap::kTheHoleValueRootIndex, slow);
__ bne(slow);
// This function is used only for loads, not stores, so it's safe to // This function is used only for loads, not stores, so it's safe to
// return an cp-based operand (the write barrier cannot be allowed to // return an cp-based operand (the write barrier cannot be allowed to
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment