Carry along ContextualMode in JSLoadNamed operators.
R=titzer@chromium.org Review URL: https://codereview.chromium.org/435393004 git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22905 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
f771870229
commit
b47fe57307
@ -1685,21 +1685,9 @@ Node* AstGraphBuilder::BuildVariableLoad(Variable* variable,
|
||||
switch (variable->location()) {
|
||||
case Variable::UNALLOCATED: {
|
||||
// Global var, const, or let variable.
|
||||
if (!info()->is_native()) {
|
||||
// TODO(turbofan): This special case is needed only because we don't
|
||||
// use LoadICs yet. Remove this once LoadNamed is lowered to an IC.
|
||||
Node* name = jsgraph()->Constant(variable->name());
|
||||
Runtime::FunctionId function_id =
|
||||
(contextual_mode == CONTEXTUAL)
|
||||
? Runtime::kLoadLookupSlot
|
||||
: Runtime::kLoadLookupSlotNoReferenceError;
|
||||
Operator* op = javascript()->Runtime(function_id, 2);
|
||||
Node* pair = NewNode(op, current_context(), name);
|
||||
return NewNode(common()->Projection(0), pair);
|
||||
}
|
||||
Node* global = BuildLoadGlobalObject();
|
||||
PrintableUnique<Name> name = MakeUnique(variable->name());
|
||||
Operator* op = javascript()->LoadNamed(name);
|
||||
Operator* op = javascript()->LoadNamed(name, contextual_mode);
|
||||
return NewNode(op, global);
|
||||
}
|
||||
case Variable::PARAMETER:
|
||||
|
@ -429,11 +429,9 @@ Node* JSGenericLowering::LowerJSLoadProperty(Node* node) {
|
||||
|
||||
|
||||
Node* JSGenericLowering::LowerJSLoadNamed(Node* node) {
|
||||
PrintableUnique<Name> key = OpParameter<PrintableUnique<Name> >(node);
|
||||
// TODO(mstarzinger): The ContextualMode needs to be carried along in the
|
||||
// operator to use JSLoadNamed for global variable loads.
|
||||
LoadICStubShim stub(isolate(), NOT_CONTEXTUAL);
|
||||
PatchInsertInput(node, 1, jsgraph()->HeapConstant(key));
|
||||
LoadNamedParameters p = OpParameter<LoadNamedParameters>(node);
|
||||
LoadICStubShim stub(isolate(), p.contextual_mode);
|
||||
PatchInsertInput(node, 1, jsgraph()->HeapConstant(p.name));
|
||||
ReplaceWithICStubCall(node, &stub);
|
||||
return node;
|
||||
}
|
||||
|
@ -36,6 +36,13 @@ class ContextAccess {
|
||||
const uint32_t index_;
|
||||
};
|
||||
|
||||
// Defines the property being loaded from an object by a named load. This is
|
||||
// used as a parameter by JSLoadNamed operators.
|
||||
struct LoadNamedParameters {
|
||||
PrintableUnique<Name> name;
|
||||
ContextualMode contextual_mode;
|
||||
};
|
||||
|
||||
// Defines the arity and the call flags for a JavaScript function call. This is
|
||||
// used as a parameter by JSCall operators.
|
||||
struct CallParameters {
|
||||
@ -109,9 +116,11 @@ class JSOperatorBuilder {
|
||||
}
|
||||
|
||||
Operator* LoadProperty() { BINOP(JSLoadProperty); }
|
||||
Operator* LoadNamed(PrintableUnique<Name> name) {
|
||||
OP1(JSLoadNamed, PrintableUnique<Name>, name, Operator::kNoProperties, 1,
|
||||
1);
|
||||
Operator* LoadNamed(PrintableUnique<Name> name,
|
||||
ContextualMode contextual_mode = NOT_CONTEXTUAL) {
|
||||
LoadNamedParameters parameters = {name, contextual_mode};
|
||||
OP1(JSLoadNamed, LoadNamedParameters, parameters, Operator::kNoProperties,
|
||||
1, 1);
|
||||
}
|
||||
|
||||
Operator* StoreProperty() { NOPROPS(JSStoreProperty, 3, 0); }
|
||||
|
@ -16,8 +16,6 @@ namespace v8 {
|
||||
namespace internal {
|
||||
namespace compiler {
|
||||
|
||||
class JSBinopReduction;
|
||||
|
||||
// Lowers JS-level operators to simplified operators based on types.
|
||||
class JSTypedLowering : public LoweringBuilder {
|
||||
public:
|
||||
|
Loading…
Reference in New Issue
Block a user