Commit e2128e3c authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [compiler] Always pass closure argument to with, catch and block context creation.

  port d3e5db04 (r32336)

  original commit message:
  Up until now we sometimes pass Smi 0 around as closure and expect the
  runtime to translate that appropriately. But we need to be careful in
  some places to not confuse the Smi 0 with a real closure. However, we
  could instead just pass the correct closure extracted from the native
  context.

  This addresses three long-standing TODOs in the JSTypedLowering pass.

  Drive-by-fix: Further unify error message reporting for ToObject (we had
  a special message in case of ToObject error in with context creation).

BUG=

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

Cr-Commit-Position: refs/heads/master@{#32356}
parent 4f3a3d58
......@@ -4710,9 +4710,10 @@ void FullCodeGenerator::PushFunctionArgumentForContextAllocation() {
closure_scope->is_module_scope()) {
// Contexts nested in the native context have a canonical empty function
// as their closure, not the anonymous closure containing the global
// code. Pass a smi sentinel and let the runtime look up the empty
// function.
__ push(Immediate(Smi::FromInt(0)));
// code.
__ mov(eax, GlobalObjectOperand());
__ mov(eax, FieldOperand(eax, JSGlobalObject::kNativeContextOffset));
__ push(ContextOperand(eax, Context::CLOSURE_INDEX));
} else if (closure_scope->is_eval_scope()) {
// Contexts nested inside eval code have the same closure as the context
// calling eval, not the anonymous closure containing the eval code.
......
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