Index: src/full-codegen/x64/full-codegen-x64.cc |
diff --git a/src/full-codegen/x64/full-codegen-x64.cc b/src/full-codegen/x64/full-codegen-x64.cc |
index 98fd6a699e66e53f211c2fee0f4b1121fc99ce12..5da01e689c9dab0298e9c1bf975d36d756bdaa18 100644 |
--- a/src/full-codegen/x64/full-codegen-x64.cc |
+++ b/src/full-codegen/x64/full-codegen-x64.cc |
@@ -1222,10 +1222,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
while (s != NULL) { |
if (s->num_heap_slots() > 0) { |
if (s->calls_sloppy_eval()) { |
- // Check that extension is NULL. |
- __ cmpp(ContextOperand(context, Context::EXTENSION_INDEX), |
- Immediate(0)); |
- __ j(not_equal, slow); |
+ // Check that extension is "the hole". |
+ __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), |
+ Heap::kTheHoleValueRootIndex, slow); |
} |
// Load next context in chain. |
__ movp(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
@@ -1252,9 +1251,9 @@ void FullCodeGenerator::EmitLoadGlobalCheckExtensions(VariableProxy* proxy, |
// Terminate at native context. |
__ cmpp(kScratchRegister, FieldOperand(temp, HeapObject::kMapOffset)); |
__ j(equal, &fast, Label::kNear); |
- // Check that extension is NULL. |
- __ cmpp(ContextOperand(temp, Context::EXTENSION_INDEX), Immediate(0)); |
- __ j(not_equal, slow); |
+ // Check that extension is "the hole". |
+ __ JumpIfNotRoot(ContextOperand(temp, Context::EXTENSION_INDEX), |
+ Heap::kTheHoleValueRootIndex, slow); |
// Load next context in chain. |
__ movp(temp, ContextOperand(temp, Context::PREVIOUS_INDEX)); |
__ jmp(&next); |
@@ -1276,19 +1275,18 @@ MemOperand FullCodeGenerator::ContextSlotOperandCheckExtensions(Variable* var, |
for (Scope* s = scope(); s != var->scope(); s = s->outer_scope()) { |
if (s->num_heap_slots() > 0) { |
if (s->calls_sloppy_eval()) { |
- // Check that extension is NULL. |
- __ cmpp(ContextOperand(context, Context::EXTENSION_INDEX), |
- Immediate(0)); |
- __ j(not_equal, slow); |
+ // Check that extension is "the hole". |
+ __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), |
+ Heap::kTheHoleValueRootIndex, slow); |
} |
__ movp(temp, ContextOperand(context, Context::PREVIOUS_INDEX)); |
// Walk the rest of the chain without clobbering rsi. |
context = temp; |
} |
} |
- // Check that last extension is NULL. |
- __ cmpp(ContextOperand(context, Context::EXTENSION_INDEX), Immediate(0)); |
- __ j(not_equal, slow); |
+ // Check that last extension is "the hole". |
+ __ JumpIfNotRoot(ContextOperand(context, Context::EXTENSION_INDEX), |
+ Heap::kTheHoleValueRootIndex, slow); |
// This function is used only for loads, not stores, so it's safe to |
// return an rsi-based operand (the write barrier cannot be allowed to |