Reviewers: Yang,
Description:
[runtime] DeclareGlobals doesn't need an explicit context parameter.
All runtime function get a context anyway, which is the same as the
explicit one in case of DeclareGlobals. So we can remove the additional
parameter there.
[email protected]
Please review this at https://codereview.chromium.org/1261863002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+30, -44 lines):
M src/arm/lithium-codegen-arm.cc
M src/arm64/lithium-codegen-arm64.cc
M src/compiler/ast-graph-builder.cc
M src/full-codegen/arm/full-codegen-arm.cc
M src/full-codegen/arm64/full-codegen-arm64.cc
M src/full-codegen/ia32/full-codegen-ia32.cc
M src/full-codegen/mips/full-codegen-mips.cc
M src/full-codegen/mips64/full-codegen-mips64.cc
M src/full-codegen/ppc/full-codegen-ppc.cc
M src/full-codegen/x64/full-codegen-x64.cc
M src/full-codegen/x87/full-codegen-x87.cc
M src/ia32/lithium-codegen-ia32.cc
M src/mips/lithium-codegen-mips.cc
M src/mips64/lithium-codegen-mips64.cc
M src/ppc/lithium-codegen-ppc.cc
M src/runtime/runtime.h
M src/runtime/runtime-scopes.cc
M src/x64/lithium-codegen-x64.cc
M src/x87/lithium-codegen-x87.cc
Index: src/arm/lithium-codegen-arm.cc
diff --git a/src/arm/lithium-codegen-arm.cc b/src/arm/lithium-codegen-arm.cc
index
d5a3d81d064cf72ff4ebfa58a547870ae96e73f4..51d56caef78ce68f544351afdc768e3e7fd70057
100644
--- a/src/arm/lithium-codegen-arm.cc
+++ b/src/arm/lithium-codegen-arm.cc
@@ -3582,12 +3582,11 @@ void LCodeGen::DoContext(LContext* instr) {
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
DCHECK(ToRegister(instr->context()).is(cp));
- __ push(cp); // The context is the first argument.
__ Move(scratch0(), instr->hydrogen()->pairs());
__ push(scratch0());
__ mov(scratch0(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
__ push(scratch0());
- CallRuntime(Runtime::kDeclareGlobals, 3, instr);
+ CallRuntime(Runtime::kDeclareGlobals, 2, instr);
}
Index: src/arm64/lithium-codegen-arm64.cc
diff --git a/src/arm64/lithium-codegen-arm64.cc
b/src/arm64/lithium-codegen-arm64.cc
index
3a2ef8f6a94c030900cc323a6e5f1f458b6f0a85..6fb1088efc71e9b6b27ff9e52c61e2b24369f44c
100644
--- a/src/arm64/lithium-codegen-arm64.cc
+++ b/src/arm64/lithium-codegen-arm64.cc
@@ -5035,8 +5035,8 @@ void LCodeGen::DoDeclareGlobals(LDeclareGlobals*
instr) {
// here.
__ LoadHeapObject(scratch1, instr->hydrogen()->pairs());
__ Mov(scratch2, Smi::FromInt(instr->hydrogen()->flags()));
- __ Push(cp, scratch1, scratch2); // The context is the first argument.
- CallRuntime(Runtime::kDeclareGlobals, 3, instr);
+ __ Push(scratch1, scratch2);
+ CallRuntime(Runtime::kDeclareGlobals, 2, instr);
}
Index: src/compiler/ast-graph-builder.cc
diff --git a/src/compiler/ast-graph-builder.cc
b/src/compiler/ast-graph-builder.cc
index
a9a767817515558621ffdf381352033aaf5a367d..db61cd1eb849a06004de021064746cae127dbb85
100644
--- a/src/compiler/ast-graph-builder.cc
+++ b/src/compiler/ast-graph-builder.cc
@@ -2917,8 +2917,8 @@ void
AstGraphBuilder::VisitDeclarations(ZoneList<Declaration*>* declarations) {
DeclareGlobalsLanguageMode::encode(language_mode());
Node* flags = jsgraph()->Constant(encoded_flags);
Node* pairs = jsgraph()->Constant(data);
- const Operator* op = javascript()->CallRuntime(Runtime::kDeclareGlobals,
3);
- Node* call = NewNode(op, current_context(), pairs, flags);
+ const Operator* op = javascript()->CallRuntime(Runtime::kDeclareGlobals,
2);
+ Node* call = NewNode(op, pairs, flags);
PrepareFrameState(call, BailoutId::Declarations());
globals()->clear();
}
Index: src/full-codegen/arm/full-codegen-arm.cc
diff --git a/src/full-codegen/arm/full-codegen-arm.cc
b/src/full-codegen/arm/full-codegen-arm.cc
index
16bd8bc27d2109dcbfb63e546978829f4c31ba00..91082ed02f463497ed5a701dcffa68747c437fb5
100644
--- a/src/full-codegen/arm/full-codegen-arm.cc
+++ b/src/full-codegen/arm/full-codegen-arm.cc
@@ -944,11 +944,10 @@ void FullCodeGenerator::VisitFunctionDeclaration(
void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals.
- // The context is the first argument.
__ mov(r1, Operand(pairs));
__ mov(r0, Operand(Smi::FromInt(DeclareGlobalsFlags())));
- __ Push(cp, r1, r0);
- __ CallRuntime(Runtime::kDeclareGlobals, 3);
+ __ Push(r1, r0);
+ __ CallRuntime(Runtime::kDeclareGlobals, 2);
// Return value is ignored.
}
Index: src/full-codegen/arm64/full-codegen-arm64.cc
diff --git a/src/full-codegen/arm64/full-codegen-arm64.cc
b/src/full-codegen/arm64/full-codegen-arm64.cc
index
40af62cf1953f2b95a2b129b24c3a722eef8b3ea..58ec744aee14ec0013c6414c879864881329c209
100644
--- a/src/full-codegen/arm64/full-codegen-arm64.cc
+++ b/src/full-codegen/arm64/full-codegen-arm64.cc
@@ -951,8 +951,8 @@ void
FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
flags = x10;
__ Mov(flags, Smi::FromInt(DeclareGlobalsFlags()));
}
- __ Push(cp, x11, flags);
- __ CallRuntime(Runtime::kDeclareGlobals, 3);
+ __ Push(x11, flags);
+ __ CallRuntime(Runtime::kDeclareGlobals, 2);
// Return value is ignored.
}
Index: src/full-codegen/ia32/full-codegen-ia32.cc
diff --git a/src/full-codegen/ia32/full-codegen-ia32.cc
b/src/full-codegen/ia32/full-codegen-ia32.cc
index
6652c92e9fd2f0a9dbdf1d48bab44a3ae11031bb..7fdeddf64f5f8c7aa83b069ec1ca499b5f441869
100644
--- a/src/full-codegen/ia32/full-codegen-ia32.cc
+++ b/src/full-codegen/ia32/full-codegen-ia32.cc
@@ -888,10 +888,9 @@ void FullCodeGenerator::VisitFunctionDeclaration(
void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals.
- __ push(esi); // The context is the first argument.
__ Push(pairs);
__ Push(Smi::FromInt(DeclareGlobalsFlags()));
- __ CallRuntime(Runtime::kDeclareGlobals, 3);
+ __ CallRuntime(Runtime::kDeclareGlobals, 2);
// Return value is ignored.
}
Index: src/full-codegen/mips/full-codegen-mips.cc
diff --git a/src/full-codegen/mips/full-codegen-mips.cc
b/src/full-codegen/mips/full-codegen-mips.cc
index
47fe9118075bba5bfe444da00e925cf686fccd6e..ec3f3db6cc698b668405c6dd7773e3f608b5c67a
100644
--- a/src/full-codegen/mips/full-codegen-mips.cc
+++ b/src/full-codegen/mips/full-codegen-mips.cc
@@ -945,11 +945,10 @@ void FullCodeGenerator::VisitFunctionDeclaration(
void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals.
- // The context is the first argument.
__ li(a1, Operand(pairs));
__ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags())));
- __ Push(cp, a1, a0);
- __ CallRuntime(Runtime::kDeclareGlobals, 3);
+ __ Push(a1, a0);
+ __ CallRuntime(Runtime::kDeclareGlobals, 2);
// Return value is ignored.
}
Index: src/full-codegen/mips64/full-codegen-mips64.cc
diff --git a/src/full-codegen/mips64/full-codegen-mips64.cc
b/src/full-codegen/mips64/full-codegen-mips64.cc
index
89c5593790dd88498819fbe442f0552a09e1cebc..d838c05059879656a8f68083a26da9ea185af2f3
100644
--- a/src/full-codegen/mips64/full-codegen-mips64.cc
+++ b/src/full-codegen/mips64/full-codegen-mips64.cc
@@ -941,11 +941,10 @@ void FullCodeGenerator::VisitFunctionDeclaration(
void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals.
- // The context is the first argument.
__ li(a1, Operand(pairs));
__ li(a0, Operand(Smi::FromInt(DeclareGlobalsFlags())));
- __ Push(cp, a1, a0);
- __ CallRuntime(Runtime::kDeclareGlobals, 3);
+ __ Push(a1, a0);
+ __ CallRuntime(Runtime::kDeclareGlobals, 2);
// Return value is ignored.
}
Index: src/full-codegen/ppc/full-codegen-ppc.cc
diff --git a/src/full-codegen/ppc/full-codegen-ppc.cc
b/src/full-codegen/ppc/full-codegen-ppc.cc
index
68a0dc0bdee861b76a0e9e910a0d7c6dfdceae5f..add711a0e64b2b449ae0ef3d10dc2de09f71b953
100644
--- a/src/full-codegen/ppc/full-codegen-ppc.cc
+++ b/src/full-codegen/ppc/full-codegen-ppc.cc
@@ -906,11 +906,10 @@ void FullCodeGenerator::VisitFunctionDeclaration(
void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals.
- // The context is the first argument.
__ mov(r4, Operand(pairs));
__ LoadSmiLiteral(r3, Smi::FromInt(DeclareGlobalsFlags()));
- __ Push(cp, r4, r3);
- __ CallRuntime(Runtime::kDeclareGlobals, 3);
+ __ Push(r4, r3);
+ __ CallRuntime(Runtime::kDeclareGlobals, 2);
// Return value is ignored.
}
Index: src/full-codegen/x64/full-codegen-x64.cc
diff --git a/src/full-codegen/x64/full-codegen-x64.cc
b/src/full-codegen/x64/full-codegen-x64.cc
index
894a64a2ee657f5c23b9b79ddaad84cf1febc17d..e80d5a5d04635e7fb919bc020d48f88e0d45e5da
100644
--- a/src/full-codegen/x64/full-codegen-x64.cc
+++ b/src/full-codegen/x64/full-codegen-x64.cc
@@ -903,10 +903,9 @@ void FullCodeGenerator::VisitFunctionDeclaration(
void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals.
- __ Push(rsi); // The context is the first argument.
__ Push(pairs);
__ Push(Smi::FromInt(DeclareGlobalsFlags()));
- __ CallRuntime(Runtime::kDeclareGlobals, 3);
+ __ CallRuntime(Runtime::kDeclareGlobals, 2);
// Return value is ignored.
}
Index: src/full-codegen/x87/full-codegen-x87.cc
diff --git a/src/full-codegen/x87/full-codegen-x87.cc
b/src/full-codegen/x87/full-codegen-x87.cc
index
40b78366bb5f22a6e208fe8c601f8e47d23ac545..43c6bb5ae78da3f907e90af7ff9a7f59d4b5e814
100644
--- a/src/full-codegen/x87/full-codegen-x87.cc
+++ b/src/full-codegen/x87/full-codegen-x87.cc
@@ -881,10 +881,9 @@ void FullCodeGenerator::VisitFunctionDeclaration(
void FullCodeGenerator::DeclareGlobals(Handle<FixedArray> pairs) {
// Call the runtime to declare the globals.
- __ push(esi); // The context is the first argument.
__ Push(pairs);
__ Push(Smi::FromInt(DeclareGlobalsFlags()));
- __ CallRuntime(Runtime::kDeclareGlobals, 3);
+ __ CallRuntime(Runtime::kDeclareGlobals, 2);
// Return value is ignored.
}
Index: src/ia32/lithium-codegen-ia32.cc
diff --git a/src/ia32/lithium-codegen-ia32.cc
b/src/ia32/lithium-codegen-ia32.cc
index
680dabdcbdbfe1820c66e824f19d8d3478b8a70a..8b528d15206191c45a60b85a77fc780614ed118c
100644
--- a/src/ia32/lithium-codegen-ia32.cc
+++ b/src/ia32/lithium-codegen-ia32.cc
@@ -3411,10 +3411,9 @@ void LCodeGen::DoContext(LContext* instr) {
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
DCHECK(ToRegister(instr->context()).is(esi));
- __ push(esi); // The context is the first argument.
__ push(Immediate(instr->hydrogen()->pairs()));
__ push(Immediate(Smi::FromInt(instr->hydrogen()->flags())));
- CallRuntime(Runtime::kDeclareGlobals, 3, instr);
+ CallRuntime(Runtime::kDeclareGlobals, 2, instr);
}
Index: src/mips/lithium-codegen-mips.cc
diff --git a/src/mips/lithium-codegen-mips.cc
b/src/mips/lithium-codegen-mips.cc
index
7985dfaeddf91501f8d11defebadd7ae8339554f..d6af3267c4452683b5e9fcfec05779239abc6d22
100644
--- a/src/mips/lithium-codegen-mips.cc
+++ b/src/mips/lithium-codegen-mips.cc
@@ -3521,9 +3521,8 @@ void LCodeGen::DoDeclareGlobals(LDeclareGlobals*
instr) {
DCHECK(ToRegister(instr->context()).is(cp));
__ li(scratch0(), instr->hydrogen()->pairs());
__ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
- // The context is the first argument.
- __ Push(cp, scratch0(), scratch1());
- CallRuntime(Runtime::kDeclareGlobals, 3, instr);
+ __ Push(scratch0(), scratch1());
+ CallRuntime(Runtime::kDeclareGlobals, 2, instr);
}
Index: src/mips64/lithium-codegen-mips64.cc
diff --git a/src/mips64/lithium-codegen-mips64.cc
b/src/mips64/lithium-codegen-mips64.cc
index
999db36c879039c765f49124a8f3a81622d2f453..b2d5332dc11a71c6e8b57c90bd4060a9f354d1e8
100644
--- a/src/mips64/lithium-codegen-mips64.cc
+++ b/src/mips64/lithium-codegen-mips64.cc
@@ -3686,9 +3686,8 @@ void LCodeGen::DoDeclareGlobals(LDeclareGlobals*
instr) {
DCHECK(ToRegister(instr->context()).is(cp));
__ li(scratch0(), instr->hydrogen()->pairs());
__ li(scratch1(), Operand(Smi::FromInt(instr->hydrogen()->flags())));
- // The context is the first argument.
- __ Push(cp, scratch0(), scratch1());
- CallRuntime(Runtime::kDeclareGlobals, 3, instr);
+ __ Push(scratch0(), scratch1());
+ CallRuntime(Runtime::kDeclareGlobals, 2, instr);
}
Index: src/ppc/lithium-codegen-ppc.cc
diff --git a/src/ppc/lithium-codegen-ppc.cc b/src/ppc/lithium-codegen-ppc.cc
index
dc9790b98847155ae52166718461fddd3ad73ac5..0a52b3b6d317a14668b2b84263821466a8b6d333
100644
--- a/src/ppc/lithium-codegen-ppc.cc
+++ b/src/ppc/lithium-codegen-ppc.cc
@@ -3765,12 +3765,11 @@ void LCodeGen::DoContext(LContext* instr) {
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
DCHECK(ToRegister(instr->context()).is(cp));
- __ push(cp); // The context is the first argument.
__ Move(scratch0(), instr->hydrogen()->pairs());
__ push(scratch0());
__ LoadSmiLiteral(scratch0(), Smi::FromInt(instr->hydrogen()->flags()));
__ push(scratch0());
- CallRuntime(Runtime::kDeclareGlobals, 3, instr);
+ CallRuntime(Runtime::kDeclareGlobals, 2, instr);
}
Index: src/runtime/runtime-scopes.cc
diff --git a/src/runtime/runtime-scopes.cc b/src/runtime/runtime-scopes.cc
index
948f7295537378fbc886d9b7bf86e40b18983b66..0df7d528157ca6994fa8433d95110474bb368aab
100644
--- a/src/runtime/runtime-scopes.cc
+++ b/src/runtime/runtime-scopes.cc
@@ -86,12 +86,12 @@ static Object* DeclareGlobals(Isolate* isolate,
Handle<GlobalObject> global,
RUNTIME_FUNCTION(Runtime_DeclareGlobals) {
HandleScope scope(isolate);
- DCHECK(args.length() == 3);
+ DCHECK_EQ(2, args.length());
Handle<GlobalObject> global(isolate->global_object());
+ Handle<Context> context(isolate->context());
- CONVERT_ARG_HANDLE_CHECKED(Context, context, 0);
- CONVERT_ARG_HANDLE_CHECKED(FixedArray, pairs, 1);
- CONVERT_SMI_ARG_CHECKED(flags, 2);
+ CONVERT_ARG_HANDLE_CHECKED(FixedArray, pairs, 0);
+ CONVERT_SMI_ARG_CHECKED(flags, 1);
// Traverse the name/value pairs and set the properties.
int length = pairs->length();
Index: src/runtime/runtime.h
diff --git a/src/runtime/runtime.h b/src/runtime/runtime.h
index
18e8af7c8d03ba3f533e6406e64cd1fb75a2c2e9..be7924b5d435a0a521d140058fc6cb2befb51a0d
100644
--- a/src/runtime/runtime.h
+++ b/src/runtime/runtime.h
@@ -538,7 +538,7 @@ namespace internal {
#define FOR_EACH_INTRINSIC_SCOPES(F) \
F(ThrowConstAssignError, 0, 1) \
- F(DeclareGlobals, 3, 1) \
+ F(DeclareGlobals, 2, 1) \
F(InitializeVarGlobal, 3, 1) \
F(InitializeConstGlobal, 2, 1) \
F(DeclareLookupSlot, 4, 1) \
Index: src/x64/lithium-codegen-x64.cc
diff --git a/src/x64/lithium-codegen-x64.cc b/src/x64/lithium-codegen-x64.cc
index
fcb470d0283737bc27128236a1c7f8fc7cdda045..15c56773546189958133fab10b42041c1e3927f7
100644
--- a/src/x64/lithium-codegen-x64.cc
+++ b/src/x64/lithium-codegen-x64.cc
@@ -3494,7 +3494,6 @@ void LCodeGen::DoContext(LContext* instr) {
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
DCHECK(ToRegister(instr->context()).is(rsi));
- __ Push(rsi); // The context is the first argument.
__ Push(instr->hydrogen()->pairs());
__ Push(Smi::FromInt(instr->hydrogen()->flags()));
CallRuntime(Runtime::kDeclareGlobals, 3, instr);
Index: src/x87/lithium-codegen-x87.cc
diff --git a/src/x87/lithium-codegen-x87.cc b/src/x87/lithium-codegen-x87.cc
index
1c632ba8e5792e87deca963369fe9a0c13dd373a..b88e29c6cf215b194c12c0ce2eccc0c5d81115be
100644
--- a/src/x87/lithium-codegen-x87.cc
+++ b/src/x87/lithium-codegen-x87.cc
@@ -3681,10 +3681,9 @@ void LCodeGen::DoContext(LContext* instr) {
void LCodeGen::DoDeclareGlobals(LDeclareGlobals* instr) {
DCHECK(ToRegister(instr->context()).is(esi));
- __ push(esi); // The context is the first argument.
__ push(Immediate(instr->hydrogen()->pairs()));
__ push(Immediate(Smi::FromInt(instr->hydrogen()->flags())));
- CallRuntime(Runtime::kDeclareGlobals, 3, instr);
+ CallRuntime(Runtime::kDeclareGlobals, 2, instr);
}
--
--
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.