Commit 6ef22472 authored by zhengxing.li's avatar zhengxing.li Committed by Commit bot

X87: [builtins] FastNewFunctionContextStub becomes a builtin.

  port f2e8c978 (r41988)

  original commit message:

BUG=

Review-Url: https://codereview.chromium.org/2603313002
Cr-Commit-Position: refs/heads/master@{#42019}
parent 0522ea74
......@@ -7,6 +7,7 @@
#include "src/crankshaft/x87/lithium-codegen-x87.h"
#include "src/base/bits.h"
#include "src/builtins/builtins-constructor.h"
#include "src/code-factory.h"
#include "src/code-stubs.h"
#include "src/codegen.h"
......@@ -146,16 +147,17 @@ void LCodeGen::DoPrologue(LPrologue* instr) {
__ CallRuntime(Runtime::kNewScriptContext);
deopt_mode = Safepoint::kLazyDeopt;
} else {
if (slots <= FastNewFunctionContextStub::MaximumSlots()) {
FastNewFunctionContextStub stub(isolate(),
info()->scope()->scope_type());
if (slots <=
ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) {
Callable callable = CodeFactory::FastNewFunctionContext(
isolate(), info()->scope()->scope_type());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
__ Call(callable.code(), RelocInfo::CODE_TARGET);
// Result of the FastNewFunctionContext builtin is always in new space.
need_write_barrier = false;
} else {
__ push(edi);
__ Push(edi);
__ Push(Smi::FromInt(info()->scope()->scope_type()));
__ CallRuntime(Runtime::kNewFunctionContext);
}
......
......@@ -4,15 +4,16 @@
#if V8_TARGET_ARCH_X87
#include "src/full-codegen/full-codegen.h"
#include "src/ast/compile-time-value.h"
#include "src/ast/scopes.h"
#include "src/builtins/builtins-constructor.h"
#include "src/code-factory.h"
#include "src/code-stubs.h"
#include "src/codegen.h"
#include "src/compilation-info.h"
#include "src/compiler.h"
#include "src/debug/debug.h"
#include "src/full-codegen/full-codegen.h"
#include "src/ic/ic.h"
#include "src/x87/frames-x87.h"
......@@ -187,12 +188,14 @@ void FullCodeGenerator::Generate() {
if (info->scope()->new_target_var() != nullptr) {
__ push(edx); // Preserve new target.
}
if (slots <= FastNewFunctionContextStub::MaximumSlots()) {
FastNewFunctionContextStub stub(isolate(), info->scope()->scope_type());
if (slots <=
ConstructorBuiltinsAssembler::MaximumFunctionContextSlots()) {
Callable callable = CodeFactory::FastNewFunctionContext(
isolate(), info->scope()->scope_type());
__ mov(FastNewFunctionContextDescriptor::SlotsRegister(),
Immediate(slots));
__ CallStub(&stub);
// Result of FastNewFunctionContextStub is always in new space.
__ Call(callable.code(), RelocInfo::CODE_TARGET);
// Result of the FastNewFunctionContext builtin is always in new space.
need_write_barrier = false;
} else {
__ push(edi);
......
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