Commit 493d48d8 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

[x86] [crankshaft] unify jump label's distance value in DoWrapReceiver().

  Currently the jump label's distance value in LCodeGen::DoWrapReceiver() of X86 is unconsistent.

  For avoiding potential bugs caused by this unconsistent usage for the same label when DeoptEveryNTimes()
  return true, This CL unify the label's distance value usage in LCodeGen::DoWrapReceiver().

  For more informations, please refer CL #41419 (https://codereview.chromium.org/2539403002/ ).

BUG=

Review-Url: https://codereview.chromium.org/2554493002
Cr-Commit-Position: refs/heads/master@{#41659}
parent dca99f4f
...@@ -2762,9 +2762,9 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { ...@@ -2762,9 +2762,9 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
// Normal function. Replace undefined or null with global receiver. // Normal function. Replace undefined or null with global receiver.
__ cmp(receiver, factory()->null_value()); __ cmp(receiver, factory()->null_value());
__ j(equal, &global_object, Label::kNear); __ j(equal, &global_object, dist);
__ cmp(receiver, factory()->undefined_value()); __ cmp(receiver, factory()->undefined_value());
__ j(equal, &global_object, Label::kNear); __ j(equal, &global_object, dist);
// The receiver should be a JS object. // The receiver should be a JS object.
__ test(receiver, Immediate(kSmiTagMask)); __ test(receiver, Immediate(kSmiTagMask));
...@@ -2772,7 +2772,7 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { ...@@ -2772,7 +2772,7 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
__ CmpObjectType(receiver, FIRST_JS_RECEIVER_TYPE, scratch); __ CmpObjectType(receiver, FIRST_JS_RECEIVER_TYPE, scratch);
DeoptimizeIf(below, instr, DeoptimizeReason::kNotAJavaScriptObject); DeoptimizeIf(below, instr, DeoptimizeReason::kNotAJavaScriptObject);
__ jmp(&receiver_ok, Label::kNear); __ jmp(&receiver_ok, dist);
__ bind(&global_object); __ bind(&global_object);
__ mov(receiver, FieldOperand(function, JSFunction::kContextOffset)); __ mov(receiver, FieldOperand(function, JSFunction::kContextOffset));
__ mov(receiver, ContextOperand(receiver, Context::NATIVE_CONTEXT_INDEX)); __ mov(receiver, ContextOperand(receiver, Context::NATIVE_CONTEXT_INDEX));
......
...@@ -2958,9 +2958,9 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { ...@@ -2958,9 +2958,9 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
// Normal function. Replace undefined or null with global receiver. // Normal function. Replace undefined or null with global receiver.
__ CompareRoot(receiver, Heap::kNullValueRootIndex); __ CompareRoot(receiver, Heap::kNullValueRootIndex);
__ j(equal, &global_object, Label::kNear); __ j(equal, &global_object, dist);
__ CompareRoot(receiver, Heap::kUndefinedValueRootIndex); __ CompareRoot(receiver, Heap::kUndefinedValueRootIndex);
__ j(equal, &global_object, Label::kNear); __ j(equal, &global_object, dist);
// The receiver should be a JS object. // The receiver should be a JS object.
Condition is_smi = __ CheckSmi(receiver); Condition is_smi = __ CheckSmi(receiver);
...@@ -2968,7 +2968,7 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) { ...@@ -2968,7 +2968,7 @@ void LCodeGen::DoWrapReceiver(LWrapReceiver* instr) {
__ CmpObjectType(receiver, FIRST_JS_RECEIVER_TYPE, kScratchRegister); __ CmpObjectType(receiver, FIRST_JS_RECEIVER_TYPE, kScratchRegister);
DeoptimizeIf(below, instr, DeoptimizeReason::kNotAJavaScriptObject); DeoptimizeIf(below, instr, DeoptimizeReason::kNotAJavaScriptObject);
__ jmp(&receiver_ok, Label::kNear); __ jmp(&receiver_ok, dist);
__ bind(&global_object); __ bind(&global_object);
__ movp(receiver, FieldOperand(function, JSFunction::kContextOffset)); __ movp(receiver, FieldOperand(function, JSFunction::kContextOffset));
__ movp(receiver, ContextOperand(receiver, Context::NATIVE_CONTEXT_INDEX)); __ movp(receiver, ContextOperand(receiver, Context::NATIVE_CONTEXT_INDEX));
......
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