Revision: 22905
Author:   [email protected]
Date:     Wed Aug  6 08:50:57 2014 UTC
Log:      Carry along ContextualMode in JSLoadNamed operators.

[email protected]

Review URL: https://codereview.chromium.org/435393004
http://code.google.com/p/v8/source/detail?r=22905

Modified:
 /branches/bleeding_edge/src/compiler/ast-graph-builder.cc
 /branches/bleeding_edge/src/compiler/js-generic-lowering.cc
 /branches/bleeding_edge/src/compiler/js-operator.h
 /branches/bleeding_edge/src/compiler/js-typed-lowering.h

=======================================
--- /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Tue Aug 5 13:32:26 2014 UTC +++ /branches/bleeding_edge/src/compiler/ast-graph-builder.cc Wed Aug 6 08:50:57 2014 UTC
@@ -1685,21 +1685,9 @@
   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:
=======================================
--- /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Tue Aug 5 13:32:26 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Wed Aug 6 08:50:57 2014 UTC
@@ -429,11 +429,9 @@


 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;
 }
=======================================
--- /branches/bleeding_edge/src/compiler/js-operator.h Mon Aug 4 11:34:54 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-operator.h Wed Aug 6 08:50:57 2014 UTC
@@ -36,6 +36,13 @@
   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 @@
   }

   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); }
=======================================
--- /branches/bleeding_edge/src/compiler/js-typed-lowering.h Wed Jul 30 13:54:45 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-typed-lowering.h Wed Aug 6 08:50:57 2014 UTC
@@ -16,8 +16,6 @@
 namespace internal {
 namespace compiler {

-class JSBinopReduction;
-
 // Lowers JS-level operators to simplified operators based on types.
 class JSTypedLowering : public LoweringBuilder {
  public:

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to