Reviewers: titzer,
Description:
Implement lowering of JSLoadContext to machine operators.
[email protected]
Please review this at https://codereview.chromium.org/433853002/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+14, -20 lines):
M src/compiler/js-generic-lowering.cc
M src/compiler/pipeline.cc
M src/runtime.h
M src/runtime.cc
M tools/generate-runtime-tests.py
Index: src/compiler/js-generic-lowering.cc
diff --git a/src/compiler/js-generic-lowering.cc
b/src/compiler/js-generic-lowering.cc
index
5085e9feb9e0ad0563b042e2dae3169de313d385..130d62591c0611d9bfbdab650b4feefaa656492e
100644
--- a/src/compiler/js-generic-lowering.cc
+++ b/src/compiler/js-generic-lowering.cc
@@ -370,9 +370,16 @@ Node* JSGenericLowering::LowerJSInstanceOf(Node* node)
{
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);
+ for (int i = 0; i < access.depth(); ++i) {
+ node->ReplaceInput(
+ 0, graph()->NewNode(
+ machine()->Load(machine()->word()),
+ 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(machine()->word()));
return node;
}
Index: src/compiler/pipeline.cc
diff --git a/src/compiler/pipeline.cc b/src/compiler/pipeline.cc
index
3086e68df0d1d2ec1f73b4b638a6fa742442f395..ef071bba8452a1aa354a0530437f238957624194
100644
--- a/src/compiler/pipeline.cc
+++ b/src/compiler/pipeline.cc
@@ -177,6 +177,8 @@ Handle<Code> Pipeline::GenerateCode() {
MachineOperatorBuilder machine(zone());
JSGenericLowering lowering(info(), &jsgraph, &machine,
&source_positions);
lowering.LowerAllNodes();
+
+ VerifyAndPrintGraph(&graph, "Lowered generic");
}
// Compute a schedule.
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
cb2e8df05d7eea384c6160b52602f2906426383a..7afa3a6aa6e6122bc1932a2a320d3077684d18d9
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -9408,20 +9408,6 @@ RUNTIME_FUNCTION(Runtime_StoreLookupSlot) {
}
-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) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 4);
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index
ca5a3f15389c62a830badd878ba5912a68a7307c..67e6148c2f3a54a046452a8f79be64c9c4400981
100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -479,7 +479,6 @@ namespace internal {
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 */ \
Index: tools/generate-runtime-tests.py
diff --git a/tools/generate-runtime-tests.py
b/tools/generate-runtime-tests.py
index
a22ac16251476b724e5e3140f79a33579d6c7522..d766409ef63476eed18ea783fc6e8e211a51b3a5
100755
--- a/tools/generate-runtime-tests.py
+++ b/tools/generate-runtime-tests.py
@@ -47,9 +47,9 @@ EXPAND_MACROS = [
# 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.