Revision: 22748
Author:   [email protected]
Date:     Thu Jul 31 11:20:36 2014 UTC
Log:      Implement lowering of JSLoadContext to machine operators.

[email protected]

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

Modified:
 /branches/bleeding_edge/src/compiler/js-generic-lowering.cc
 /branches/bleeding_edge/src/compiler/pipeline.cc
 /branches/bleeding_edge/src/runtime.cc
 /branches/bleeding_edge/src/runtime.h
 /branches/bleeding_edge/tools/generate-runtime-tests.py

=======================================
--- /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Wed Jul 30 13:54:45 2014 UTC +++ /branches/bleeding_edge/src/compiler/js-generic-lowering.cc Thu Jul 31 11:20:36 2014 UTC
@@ -370,9 +370,18 @@

 Node* JSGenericLowering::LowerJSLoadContext(Node* node) {
   ContextAccess access = OpParameter<ContextAccess>(node);
-  PatchInsertInput(node, 1, SmiConstant(access.depth()));
-  PatchInsertInput(node, 2, SmiConstant(access.index()));
-  ReplaceWithRuntimeCall(node, Runtime::kLoadContextRelative, 3);
+ // TODO(mstarzinger): Use simplified operators instead of machine operators
+  // here so that load/store optimization can be applied afterwards.
+  for (int i = 0; i < access.depth(); ++i) {
+    node->ReplaceInput(
+        0, graph()->NewNode(
+               machine()->Load(kMachineTagged),
+               NodeProperties::GetValueInput(node, 0),
+               Int32Constant(Context::SlotOffset(Context::PREVIOUS_INDEX)),
+               NodeProperties::GetEffectInput(node)));
+  }
+ node->ReplaceInput(1, Int32Constant(Context::SlotOffset(access.index())));
+  PatchOperator(node, machine()->Load(kMachineTagged));
   return node;
 }

=======================================
--- /branches/bleeding_edge/src/compiler/pipeline.cc Wed Jul 30 16:21:36 2014 UTC +++ /branches/bleeding_edge/src/compiler/pipeline.cc Thu Jul 31 11:20:36 2014 UTC
@@ -177,6 +177,8 @@
     MachineOperatorBuilder machine(zone());
JSGenericLowering lowering(info(), &jsgraph, &machine, &source_positions);
     lowering.LowerAllNodes();
+
+    VerifyAndPrintGraph(&graph, "Lowered generic");
   }

   // Compute a schedule.
=======================================
--- /branches/bleeding_edge/src/runtime.cc      Thu Jul 31 08:29:34 2014 UTC
+++ /branches/bleeding_edge/src/runtime.cc      Thu Jul 31 11:20:36 2014 UTC
@@ -9406,20 +9406,6 @@

   return *value;
 }
-
-
-RUNTIME_FUNCTION(Runtime_LoadContextRelative) {
-  SealHandleScope shs(isolate);
-  ASSERT(args.length() == 3);
-  CONVERT_ARG_CHECKED(Context, context, 0);
-  CONVERT_SMI_ARG_CHECKED(depth, 1);
-  CONVERT_SMI_ARG_CHECKED(index, 2);
-  while (depth-- > 0) {
-    context = context->previous();
-    ASSERT(context->IsContext());
-  }
-  return context->get(index);
-}


 RUNTIME_FUNCTION(Runtime_StoreContextRelative) {
=======================================
--- /branches/bleeding_edge/src/runtime.h       Wed Jul 30 13:54:45 2014 UTC
+++ /branches/bleeding_edge/src/runtime.h       Thu Jul 31 11:20:36 2014 UTC
@@ -479,7 +479,6 @@
   F(PushModuleContext, 2, 1)                                         \
   F(DeleteLookupSlot, 2, 1)                                          \
   F(LoadLookupSlot, 2, 2)                                            \
-  F(LoadContextRelative, 3, 1) /* TODO(turbofan): Only temporary */  \
   F(LoadLookupSlotNoReferenceError, 2, 2)                            \
   F(StoreLookupSlot, 4, 1)                                           \
   F(StoreContextRelative, 4, 1) /* TODO(turbofan): Only temporary */ \
=======================================
--- /branches/bleeding_edge/tools/generate-runtime-tests.py Wed Jul 30 13:54:45 2014 UTC +++ /branches/bleeding_edge/tools/generate-runtime-tests.py Thu Jul 31 11:20:36 2014 UTC
@@ -47,9 +47,9 @@
# that the parser doesn't bit-rot. Change the values as needed when you add, # remove or change runtime functions, but make sure we don't lose our ability
 # to parse them!
-EXPECTED_FUNCTION_COUNT = 427
+EXPECTED_FUNCTION_COUNT = 426
 EXPECTED_FUZZABLE_COUNT = 338
-EXPECTED_CCTEST_COUNT = 11
+EXPECTED_CCTEST_COUNT = 10
 EXPECTED_UNKNOWN_COUNT = 4
 EXPECTED_BUILTINS_COUNT = 816

--
--
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