Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(75)

Unified Diff: src/compiler/ast-graph-builder.cc

Issue 613683002: [turbofan] Some javascript operators are globally shared singletons. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Fix Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/change-lowering.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc b/src/compiler/ast-graph-builder.cc
index 03640780b656186b653eb05aba656d5093553e76..1fb68bfed0876412aa357cedf49e8672784ce38c 100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -75,7 +75,8 @@ bool AstGraphBuilder::CreateGraph() {
// Emit tracing call if requested to do so.
if (FLAG_trace) {
- NewNode(javascript()->Runtime(Runtime::kTraceEnter, 0));
+ NewNode(javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kTraceEnter, 0)));
Michael Starzinger 2014/09/29 15:24:06 I think we should continue to let the factory meth
Benedikt Meurer 2014/09/30 04:44:05 Done.
}
// Visit implicit declaration of the function name.
@@ -87,7 +88,8 @@ bool AstGraphBuilder::CreateGraph() {
VisitDeclarations(scope->declarations());
// TODO(mstarzinger): This should do an inlined stack check.
- Node* node = NewNode(javascript()->Runtime(Runtime::kStackGuard, 0));
+ Node* node = NewNode(javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kStackGuard, 0)));
PrepareFrameState(node, BailoutId::FunctionEntry());
// Visit statements in the function body.
@@ -98,7 +100,9 @@ bool AstGraphBuilder::CreateGraph() {
if (FLAG_trace) {
// TODO(mstarzinger): Only traces implicit return.
Node* return_value = jsgraph()->UndefinedConstant();
- NewNode(javascript()->Runtime(Runtime::kTraceExit, 1), return_value);
+ NewNode(javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kTraceExit, 1)),
+ return_value);
}
// Return 'undefined' in case we can fall off the end.
@@ -374,7 +378,8 @@ void AstGraphBuilder::VisitVariableDeclaration(VariableDeclaration* decl) {
case Variable::CONTEXT:
if (hole_init) {
Node* value = jsgraph()->TheHoleConstant();
- const Operator* op = javascript()->StoreContext(0, variable->index());
+ const Operator* op =
+ javascript()->StoreContext(ContextAccess(0, variable->index()));
NewNode(op, current_context(), value);
}
break;
@@ -406,7 +411,8 @@ void AstGraphBuilder::VisitFunctionDeclaration(FunctionDeclaration* decl) {
case Variable::CONTEXT: {
VisitForValue(decl->fun());
Node* value = environment()->Pop();
- const Operator* op = javascript()->StoreContext(0, variable->index());
+ const Operator* op =
+ javascript()->StoreContext(ContextAccess(0, variable->index()));
NewNode(op, current_context(), value);
break;
}
@@ -642,21 +648,27 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
environment()->Push(obj);
// TODO(dcarney): should do a fast enum cache check here to skip runtime.
environment()->Push(obj);
- Node* cache_type = ProcessArguments(
- javascript()->Runtime(Runtime::kGetPropertyNamesFast, 1), 1);
+ Node* cache_type =
+ ProcessArguments(javascript()->CallRuntime(CallRuntimeParameters(
+ Runtime::kGetPropertyNamesFast, 1)),
+ 1);
// TODO(dcarney): these next runtime calls should be removed in favour of
// a few simplified instructions.
environment()->Push(obj);
environment()->Push(cache_type);
Node* cache_pair =
- ProcessArguments(javascript()->Runtime(Runtime::kForInInit, 2), 2);
+ ProcessArguments(javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kForInInit, 2)),
+ 2);
// cache_type may have been replaced.
Node* cache_array = NewNode(common()->Projection(0), cache_pair);
cache_type = NewNode(common()->Projection(1), cache_pair);
environment()->Push(cache_type);
environment()->Push(cache_array);
- Node* cache_length = ProcessArguments(
- javascript()->Runtime(Runtime::kForInCacheArrayLength, 2), 2);
+ Node* cache_length =
+ ProcessArguments(javascript()->CallRuntime(CallRuntimeParameters(
+ Runtime::kForInCacheArrayLength, 2)),
+ 2);
{
// TODO(dcarney): this check is actually supposed to be for the
// empty enum case only.
@@ -693,7 +705,9 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
environment()->Push(cache_type);
environment()->Push(index);
Node* pair =
- ProcessArguments(javascript()->Runtime(Runtime::kForInNext, 4), 4);
+ ProcessArguments(javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kForInNext, 4)),
+ 4);
Node* value = NewNode(common()->Projection(0), pair);
Node* should_filter = NewNode(common()->Projection(1), pair);
environment()->Push(value);
@@ -719,7 +733,9 @@ void AstGraphBuilder::VisitForInStatement(ForInStatement* stmt) {
// result is either the string key or Smi(0) indicating the property
// is gone.
Node* res = ProcessArguments(
- javascript()->Call(3, NO_CALL_FUNCTION_FLAGS), 3);
+ javascript()->CallFunction(
+ CallFunctionParameters(3, NO_CALL_FUNCTION_FLAGS)),
+ 3);
// TODO(jarin): provide real bailout id.
PrepareFrameState(res, BailoutId::None());
Node* property_missing = NewNode(javascript()->StrictEqual(), res,
@@ -785,7 +801,8 @@ void AstGraphBuilder::VisitTryFinallyStatement(TryFinallyStatement* stmt) {
void AstGraphBuilder::VisitDebuggerStatement(DebuggerStatement* stmt) {
// TODO(turbofan): Do we really need a separate reloc-info for this?
- Node* node = NewNode(javascript()->Runtime(Runtime::kDebugBreak, 0));
+ Node* node = NewNode(javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kDebugBreak, 0)));
PrepareFrameState(node, stmt->DebugBreakId());
}
@@ -806,7 +823,8 @@ void AstGraphBuilder::VisitFunctionLiteral(FunctionLiteral* expr) {
Node* info = jsgraph()->Constant(shared_info);
Node* pretenure = expr->pretenure() ? jsgraph()->TrueConstant()
: jsgraph()->FalseConstant();
- const Operator* op = javascript()->Runtime(Runtime::kNewClosure, 3);
+ const Operator* op =
+ javascript()->CallRuntime(CallRuntimeParameters(Runtime::kNewClosure, 3));
Node* value = NewNode(op, context, info, pretenure);
ast_context()->ProduceValue(value);
}
@@ -858,8 +876,8 @@ void AstGraphBuilder::VisitRegExpLiteral(RegExpLiteral* expr) {
Node* literal_index = jsgraph()->Constant(expr->literal_index());
Node* pattern = jsgraph()->Constant(expr->pattern());
Node* flags = jsgraph()->Constant(expr->flags());
- const Operator* op =
- javascript()->Runtime(Runtime::kMaterializeRegExpLiteral, 4);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kMaterializeRegExpLiteral, 4));
Node* literal = NewNode(op, literals_array, literal_index, pattern, flags);
ast_context()->ProduceValue(literal);
}
@@ -875,7 +893,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* literal_index = jsgraph()->Constant(expr->literal_index());
Node* constants = jsgraph()->Constant(expr->constant_properties());
Node* flags = jsgraph()->Constant(expr->ComputeFlags());
- const Operator* op = javascript()->Runtime(Runtime::kCreateObjectLiteral, 4);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kCreateObjectLiteral, 4));
Node* literal = NewNode(op, literals_array, literal_index, constants, flags);
// The object is expected on the operand stack during computation of the
@@ -908,7 +927,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForValue(property->value());
Node* value = environment()->Pop();
Unique<Name> name = MakeUnique(key->AsPropertyName());
- Node* store = NewNode(javascript()->StoreNamed(strict_mode(), name),
+ Node* store = NewNode(javascript()->StoreNamed(StoreNamedParameters(
+ strict_mode(), name)),
literal, value);
PrepareFrameState(store, key->id());
} else {
@@ -924,7 +944,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* receiver = environment()->Pop();
if (property->emit_store()) {
Node* strict = jsgraph()->Constant(SLOPPY);
- const Operator* op = javascript()->Runtime(Runtime::kSetProperty, 4);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kSetProperty, 4));
NewNode(op, receiver, key, value, strict);
}
break;
@@ -935,7 +956,8 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* value = environment()->Pop();
Node* receiver = environment()->Pop();
if (property->emit_store()) {
- const Operator* op = javascript()->Runtime(Runtime::kSetPrototype, 2);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kSetPrototype, 2));
NewNode(op, receiver, value);
}
break;
@@ -960,15 +982,16 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
Node* getter = environment()->Pop();
Node* name = environment()->Pop();
Node* attr = jsgraph()->Constant(NONE);
- const Operator* op =
- javascript()->Runtime(Runtime::kDefineAccessorPropertyUnchecked, 5);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kDefineAccessorPropertyUnchecked, 5));
Node* call = NewNode(op, literal, name, getter, setter, attr);
PrepareFrameState(call, it->first->id());
}
// Transform literals that contain functions to fast properties.
if (expr->has_function()) {
- const Operator* op = javascript()->Runtime(Runtime::kToFastProperties, 1);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kToFastProperties, 1));
NewNode(op, literal);
}
@@ -986,7 +1009,8 @@ void AstGraphBuilder::VisitArrayLiteral(ArrayLiteral* expr) {
Node* literal_index = jsgraph()->Constant(expr->literal_index());
Node* constants = jsgraph()->Constant(expr->constant_elements());
Node* flags = jsgraph()->Constant(expr->ComputeFlags());
- const Operator* op = javascript()->Runtime(Runtime::kCreateArrayLiteral, 4);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kCreateArrayLiteral, 4));
Node* literal = NewNode(op, literals_array, literal_index, constants, flags);
// The array and the literal index are both expected on the operand stack
@@ -1035,8 +1059,9 @@ void AstGraphBuilder::VisitForInAssignment(Expression* expr, Node* value) {
value = environment()->Pop();
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- Node* store =
- NewNode(javascript()->StoreNamed(strict_mode(), name), object, value);
+ Node* store = NewNode(
+ javascript()->StoreNamed(StoreNamedParameters(strict_mode(), name)),
+ object, value);
// TODO(jarin) Fill in the correct bailout id.
PrepareFrameState(store, BailoutId::None());
break;
@@ -1094,7 +1119,8 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) {
Node* object = environment()->Top();
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- old_value = NewNode(javascript()->LoadNamed(name), object);
+ old_value =
+ NewNode(javascript()->LoadNamed(LoadNamedParameters(name)), object);
PrepareFrameState(old_value, property->LoadId(), kPushOutput);
break;
}
@@ -1130,8 +1156,9 @@ void AstGraphBuilder::VisitAssignment(Assignment* expr) {
Node* object = environment()->Pop();
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- Node* store =
- NewNode(javascript()->StoreNamed(strict_mode(), name), object, value);
+ Node* store = NewNode(
+ javascript()->StoreNamed(StoreNamedParameters(strict_mode(), name)),
+ object, value);
PrepareFrameState(store, expr->AssignmentId());
break;
}
@@ -1162,7 +1189,8 @@ void AstGraphBuilder::VisitYield(Yield* expr) {
void AstGraphBuilder::VisitThrow(Throw* expr) {
VisitForValue(expr->exception());
Node* exception = environment()->Pop();
- const Operator* op = javascript()->Runtime(Runtime::kThrow, 1);
+ const Operator* op =
+ javascript()->CallRuntime(CallRuntimeParameters(Runtime::kThrow, 1));
Node* value = NewNode(op, exception);
ast_context()->ProduceValue(value);
}
@@ -1174,7 +1202,7 @@ void AstGraphBuilder::VisitProperty(Property* expr) {
VisitForValue(expr->obj());
Node* object = environment()->Pop();
Unique<Name> name = MakeUnique(expr->key()->AsLiteral()->AsPropertyName());
- value = NewNode(javascript()->LoadNamed(name), object);
+ value = NewNode(javascript()->LoadNamed(LoadNamedParameters(name)), object);
} else {
VisitForValue(expr->obj());
VisitForValue(expr->key());
@@ -1208,7 +1236,8 @@ void AstGraphBuilder::VisitCall(Call* expr) {
Variable* variable = callee->AsVariableProxy()->var();
DCHECK(variable->location() == Variable::LOOKUP);
Node* name = jsgraph()->Constant(variable->name());
- const Operator* op = javascript()->Runtime(Runtime::kLoadLookupSlot, 2);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kLoadLookupSlot, 2));
Node* pair = NewNode(op, current_context(), name);
callee_value = NewNode(common()->Projection(0), pair);
receiver_value = NewNode(common()->Projection(1), pair);
@@ -1221,7 +1250,8 @@ void AstGraphBuilder::VisitCall(Call* expr) {
if (property->key()->IsPropertyName()) {
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- callee_value = NewNode(javascript()->LoadNamed(name), object);
+ callee_value =
+ NewNode(javascript()->LoadNamed(LoadNamedParameters(name)), object);
} else {
VisitForValue(property->key());
Node* key = environment()->Pop();
@@ -1268,8 +1298,8 @@ void AstGraphBuilder::VisitCall(Call* expr) {
Node* receiver = environment()->Lookup(info()->scope()->receiver());
Node* strict = jsgraph()->Constant(strict_mode());
Node* position = jsgraph()->Constant(info()->scope()->start_position());
- const Operator* op =
- javascript()->Runtime(Runtime::kResolvePossiblyDirectEval, 5);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kResolvePossiblyDirectEval, 5));
Node* pair = NewNode(op, callee, source, receiver, strict, position);
Node* new_callee = NewNode(common()->Projection(0), pair);
Node* new_receiver = NewNode(common()->Projection(1), pair);
@@ -1280,7 +1310,8 @@ void AstGraphBuilder::VisitCall(Call* expr) {
}
// Create node to perform the function call.
- const Operator* call = javascript()->Call(args->length() + 2, flags);
+ const Operator* call = javascript()->CallFunction(
+ CallFunctionParameters(args->length() + 2, flags));
Node* value = ProcessArguments(call, args->length() + 2);
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@@ -1295,7 +1326,7 @@ void AstGraphBuilder::VisitCallNew(CallNew* expr) {
VisitForValues(args);
// Create node to perform the construct call.
- const Operator* call = javascript()->CallNew(args->length() + 1);
+ const Operator* call = javascript()->CallConstruct(args->length() + 1);
Node* value = ProcessArguments(call, args->length() + 1);
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@@ -1310,7 +1341,8 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
CallFunctionFlags flags = NO_CALL_FUNCTION_FLAGS;
Node* receiver_value = BuildLoadBuiltinsObject();
Unique<String> unique = MakeUnique(name);
- Node* callee_value = NewNode(javascript()->LoadNamed(unique), receiver_value);
+ Node* callee_value = NewNode(
+ javascript()->LoadNamed(LoadNamedParameters(unique)), receiver_value);
// TODO(jarin): Find/create a bailout id to deoptimize to (crankshaft
// refuses to optimize functions with jsruntime calls).
PrepareFrameState(callee_value, BailoutId::None(), kPushOutput);
@@ -1322,7 +1354,8 @@ void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) {
VisitForValues(args);
// Create node to perform the JS runtime call.
- const Operator* call = javascript()->Call(args->length() + 2, flags);
+ const Operator* call = javascript()->CallFunction(
+ CallFunctionParameters(args->length() + 2, flags));
Node* value = ProcessArguments(call, args->length() + 2);
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@@ -1345,7 +1378,8 @@ void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) {
// Create node to perform the runtime call.
Runtime::FunctionId functionId = function->function_id;
- const Operator* call = javascript()->Runtime(functionId, args->length());
+ const Operator* call = javascript()->CallRuntime(
+ CallRuntimeParameters(functionId, args->length()));
Node* value = ProcessArguments(call, args->length());
PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
ast_context()->ProduceValue(value);
@@ -1394,7 +1428,8 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
Node* object = environment()->Top();
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- old_value = NewNode(javascript()->LoadNamed(name), object);
+ old_value =
+ NewNode(javascript()->LoadNamed(LoadNamedParameters(name)), object);
PrepareFrameState(old_value, property->LoadId(), kPushOutput);
stack_depth = 1;
break;
@@ -1438,8 +1473,9 @@ void AstGraphBuilder::VisitCountOperation(CountOperation* expr) {
Node* object = environment()->Pop();
Unique<Name> name =
MakeUnique(property->key()->AsLiteral()->AsPropertyName());
- Node* store =
- NewNode(javascript()->StoreNamed(strict_mode(), name), object, value);
+ Node* store = NewNode(
+ javascript()->StoreNamed(StoreNamedParameters(strict_mode(), name)),
+ object, value);
environment()->Push(value);
PrepareFrameState(store, expr->AssignmentId());
environment()->Pop();
@@ -1557,7 +1593,8 @@ void AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>* declarations) {
DeclareGlobalsStrictMode::encode(strict_mode());
Node* flags = jsgraph()->Constant(encoded_flags);
Node* pairs = jsgraph()->Constant(data);
- const Operator* op = javascript()->Runtime(Runtime::kDeclareGlobals, 3);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kDeclareGlobals, 3));
NewNode(op, current_context(), pairs, flags);
globals()->Rewind(0);
}
@@ -1664,6 +1701,11 @@ void AstGraphBuilder::VisitLogicalExpression(BinaryOperation* expr) {
}
+StrictMode AstGraphBuilder::strict_mode() const {
+ return info()->strict_mode();
+}
+
+
Node* AstGraphBuilder::ProcessArguments(const Operator* op, int arity) {
DCHECK(environment()->stack_height() >= arity);
Node** all = info()->zone()->NewArray<Node*>(arity);
@@ -1695,7 +1737,8 @@ Node* AstGraphBuilder::BuildLocalFunctionContext(Node* context, Node* closure) {
Node* parameter = NewNode(common()->Parameter(i + 1), graph()->start());
// Context variable (at bottom of the context chain).
DCHECK_EQ(0, info()->scope()->ContextChainLength(variable->scope()));
- const Operator* op = javascript()->StoreContext(0, variable->index());
+ const Operator* op =
+ javascript()->StoreContext(ContextAccess(0, variable->index()));
NewNode(op, local_context, parameter);
}
@@ -1708,7 +1751,8 @@ Node* AstGraphBuilder::BuildArgumentsObject(Variable* arguments) {
// Allocate and initialize a new arguments object.
Node* callee = GetFunctionClosure();
- const Operator* op = javascript()->Runtime(Runtime::kNewArguments, 1);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kNewArguments, 1));
Node* object = NewNode(op, callee);
// Assign the object to the arguments variable.
@@ -1760,7 +1804,8 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
// Global var, const, or let variable.
Node* global = BuildLoadGlobalObject();
Unique<Name> name = MakeUnique(variable->name());
- const Operator* op = javascript()->LoadNamed(name, contextual_mode);
+ const Operator* op =
+ javascript()->LoadNamed(LoadNamedParameters(name, contextual_mode));
Node* node = NewNode(op, global);
PrepareFrameState(node, bailout_id, kPushOutput);
return node;
@@ -1791,8 +1836,8 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
// Context variable (potentially up the context chain).
int depth = current_scope()->ContextChainLength(variable->scope());
bool immutable = variable->maybe_assigned() == kNotAssigned;
- const Operator* op =
- javascript()->LoadContext(depth, variable->index(), immutable);
+ const Operator* op = javascript()->LoadContext(
+ ContextAccess(depth, variable->index(), immutable));
Node* value = NewNode(op, current_context());
// TODO(titzer): initialization checks are redundant for already
// initialized immutable context loads, but only specialization knows.
@@ -1814,7 +1859,8 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
(contextual_mode == CONTEXTUAL)
? Runtime::kLoadLookupSlot
: Runtime::kLoadLookupSlotNoReferenceError;
- const Operator* op = javascript()->Runtime(function_id, 2);
+ const Operator* op =
+ javascript()->CallRuntime(CallRuntimeParameters(function_id, 2));
Node* pair = NewNode(op, current_context(), name);
return NewNode(common()->Projection(0), pair);
}
@@ -1842,7 +1888,8 @@ Node* AstGraphBuilder::BuildVariableDelete(Variable* variable) {
case Variable::LOOKUP: {
// Dynamic lookup of context variable (anywhere in the chain).
Node* name = jsgraph()->Constant(variable->name());
- const Operator* op = javascript()->Runtime(Runtime::kDeleteLookupSlot, 2);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kDeleteLookupSlot, 2));
return NewNode(op, current_context(), name);
}
}
@@ -1861,7 +1908,8 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
// Global var, const, or let variable.
Node* global = BuildLoadGlobalObject();
Unique<Name> name = MakeUnique(variable->name());
- const Operator* op = javascript()->StoreNamed(strict_mode(), name);
+ const Operator* op =
+ javascript()->StoreNamed(StoreNamedParameters(strict_mode(), name));
Node* store = NewNode(op, global, value);
PrepareFrameState(store, bailout_id);
return store;
@@ -1901,7 +1949,7 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
if (mode == CONST_LEGACY && op == Token::INIT_CONST_LEGACY) {
// Perform an initialization check for legacy const variables.
const Operator* op =
- javascript()->LoadContext(depth, variable->index(), false);
+ javascript()->LoadContext(ContextAccess(depth, variable->index()));
Node* current = NewNode(op, current_context());
value = BuildHoleCheckSilent(current, value, current);
} else if (mode == CONST_LEGACY && op != Token::INIT_CONST_LEGACY) {
@@ -1910,14 +1958,15 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
} else if (mode == LET && op != Token::INIT_LET) {
// Perform an initialization check for let declared variables.
const Operator* op =
- javascript()->LoadContext(depth, variable->index(), false);
+ javascript()->LoadContext(ContextAccess(depth, variable->index()));
Node* current = NewNode(op, current_context());
value = BuildHoleCheckThrow(current, variable, value);
} else if (mode == CONST && op != Token::INIT_CONST) {
// All assignments to const variables are early errors.
UNREACHABLE();
}
- const Operator* op = javascript()->StoreContext(depth, variable->index());
+ const Operator* op =
+ javascript()->StoreContext(ContextAccess(depth, variable->index()));
return NewNode(op, current_context(), value);
}
case Variable::LOOKUP: {
@@ -1926,7 +1975,8 @@ Node* AstGraphBuilder::BuildVariableAssignment(Variable* variable, Node* value,
Node* strict = jsgraph()->Constant(strict_mode());
// TODO(mstarzinger): Use Runtime::kInitializeLegacyConstLookupSlot for
// initializations of const declarations.
- const Operator* op = javascript()->Runtime(Runtime::kStoreLookupSlot, 4);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kStoreLookupSlot, 4));
return NewNode(op, value, current_context(), name, strict);
}
}
@@ -1953,8 +2003,8 @@ Node* AstGraphBuilder::BuildLoadBuiltinsObject() {
Node* AstGraphBuilder::BuildLoadGlobalObject() {
Node* context = GetFunctionContext();
- const Operator* load_op =
- javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true);
+ const Operator* load_op = javascript()->LoadContext(
+ ContextAccess(0, Context::GLOBAL_OBJECT_INDEX, true));
return NewNode(load_op, context);
}
@@ -1968,7 +2018,8 @@ Node* AstGraphBuilder::BuildToBoolean(Node* value) {
Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable) {
// TODO(mstarzinger): Should be unified with the VisitThrow implementation.
Node* variable_name = jsgraph()->Constant(variable->name());
- const Operator* op = javascript()->Runtime(Runtime::kThrowReferenceError, 1);
+ const Operator* op = javascript()->CallRuntime(
+ CallRuntimeParameters(Runtime::kThrowReferenceError, 1));
return NewNode(op, variable_name);
}
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/compiler/change-lowering.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698