Reviewers: Sven Panne,
Description:
remove getcurrent from stubs
[email protected]
BUG=
Please review this at https://codereview.chromium.org/23756009/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+40, -28 lines):
M src/arm/builtins-arm.cc
M src/arm/code-stubs-arm.cc
M src/arm/codegen-arm.cc
M src/ia32/builtins-ia32.cc
M src/ia32/codegen-ia32.cc
M src/objects.h
M src/objects.cc
M src/runtime.h
M src/runtime.cc
M src/x64/builtins-x64.cc
M src/x64/code-stubs-x64.cc
M src/x64/codegen-x64.cc
Index: src/arm/builtins-arm.cc
diff --git a/src/arm/builtins-arm.cc b/src/arm/builtins-arm.cc
index
8862702b6fc55a77d5df77da689a4b084cb244be..672274c9150505c1c3df4bd15746044e8201ee83
100644
--- a/src/arm/builtins-arm.cc
+++ b/src/arm/builtins-arm.cc
@@ -862,13 +862,15 @@ static void
GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
// The following registers must be saved and restored when calling
through to
// the runtime:
// r0 - contains return address (beginning of patch sequence)
- // r1 - function object
+ // r1 - the isolate
+ // r2 - function object
FrameScope scope(masm, StackFrame::MANUAL);
- __ stm(db_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit());
- __ PrepareCallCFunction(1, 0, r1);
+ __ stm(db_w, sp, r0.bit() | r1.bit() | r2.bit() | fp.bit() | lr.bit());
+ __ mov(r1, Operand(ExternalReference::isolate_address(masm->isolate())));
+ __ PrepareCallCFunction(2, 0, r2);
__ CallCFunction(
- ExternalReference::get_make_code_young_function(masm->isolate()), 1);
- __ ldm(ia_w, sp, r0.bit() | r1.bit() | fp.bit() | lr.bit());
+ ExternalReference::get_make_code_young_function(masm->isolate()), 2);
+ __ ldm(ia_w, sp, r0.bit() | r1.bit() | r2.bit() | fp.bit() | lr.bit());
__ mov(pc, r0);
}
Index: src/arm/code-stubs-arm.cc
diff --git a/src/arm/code-stubs-arm.cc b/src/arm/code-stubs-arm.cc
index
740cb9b094331e238ab1ee8b61a7d77a0c0b5659..6817e7a596a823493a800ef03f42219a3c78deec
100644
--- a/src/arm/code-stubs-arm.cc
+++ b/src/arm/code-stubs-arm.cc
@@ -2765,9 +2765,10 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
if (do_gc) {
// Passing r0.
- __ PrepareCallCFunction(1, 0, r1);
+ __ PrepareCallCFunction(2, 0, r1);
+ __ mov(r1,
Operand(ExternalReference::isolate_address(masm->isolate())));
__ CallCFunction(ExternalReference::perform_gc_function(isolate),
- 1, 0);
+ 2, 0);
}
ExternalReference scope_depth =
Index: src/arm/codegen-arm.cc
diff --git a/src/arm/codegen-arm.cc b/src/arm/codegen-arm.cc
index
faf7b54d43a139139d37789afca4ce46eb639c24..3917946b56e55bca4150c32f696b76e6f4d8cd49
100644
--- a/src/arm/codegen-arm.cc
+++ b/src/arm/codegen-arm.cc
@@ -879,7 +879,8 @@ void Code::GetCodeAgeAndParity(byte* sequence, Age* age,
}
-void Code::PatchPlatformCodeAge(byte* sequence,
+void Code::PatchPlatformCodeAge(Isolate* isolate,
+ byte* sequence,
Code::Age age,
MarkingParity parity) {
uint32_t young_length;
@@ -888,7 +889,7 @@ void Code::PatchPlatformCodeAge(byte* sequence,
CopyBytes(sequence, young_sequence, young_length);
CPU::FlushICache(sequence, young_length);
} else {
- Code* stub = GetCodeAgeStub(age, parity);
+ Code* stub = GetCodeAgeStub(isolate, age, parity);
CodePatcher patcher(sequence, young_length / Assembler::kInstrSize);
patcher.masm()->add(r0, pc, Operand(-8));
patcher.masm()->ldr(pc, MemOperand(pc, -4));
Index: src/ia32/builtins-ia32.cc
diff --git a/src/ia32/builtins-ia32.cc b/src/ia32/builtins-ia32.cc
index
a617da71d367745f58356b55dbcd6ccdc3b32d15..3ab110d87e2b70d625c61821c205b12fb0fb053a
100644
--- a/src/ia32/builtins-ia32.cc
+++ b/src/ia32/builtins-ia32.cc
@@ -584,10 +584,12 @@ static void
GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
__ mov(eax, Operand(esp, 8 * kPointerSize));
{
FrameScope scope(masm, StackFrame::MANUAL);
- __ PrepareCallCFunction(1, ebx);
- __ mov(Operand(esp, 0), eax);
+ __ PrepareCallCFunction(2, ebx);
+ __ mov(Operand(esp, 1 * kPointerSize), eax);
+ __ mov(Operand(esp, 0),
+ Immediate(ExternalReference::isolate_address(masm->isolate())));
__ CallCFunction(
- ExternalReference::get_make_code_young_function(masm->isolate()),
1);
+ ExternalReference::get_make_code_young_function(masm->isolate()),
2);
}
__ popad();
__ ret(0);
Index: src/ia32/codegen-ia32.cc
diff --git a/src/ia32/codegen-ia32.cc b/src/ia32/codegen-ia32.cc
index
0e4fe8c41ba40ba2c06ebee281763cbd12296579..093937f3ec2813a336ed7cbfc080e3d761b98dbe
100644
--- a/src/ia32/codegen-ia32.cc
+++ b/src/ia32/codegen-ia32.cc
@@ -1173,7 +1173,8 @@ void Code::GetCodeAgeAndParity(byte* sequence, Age*
age,
}
-void Code::PatchPlatformCodeAge(byte* sequence,
+void Code::PatchPlatformCodeAge(Isolate* isolate,
+ byte* sequence,
Code::Age age,
MarkingParity parity) {
uint32_t young_length;
@@ -1182,7 +1183,7 @@ void Code::PatchPlatformCodeAge(byte* sequence,
CopyBytes(sequence, young_sequence, young_length);
CPU::FlushICache(sequence, young_length);
} else {
- Code* stub = GetCodeAgeStub(age, parity);
+ Code* stub = GetCodeAgeStub(isolate, age, parity);
CodePatcher patcher(sequence, young_length);
patcher.masm()->call(stub->instruction_start(), RelocInfo::NONE32);
}
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index
4ca3d57de2c4b560384e2f8649e481ffd6953202..9507839f87e53fb40d005227ca901624d5d008b0
100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -10476,8 +10476,8 @@ bool Code::allowed_in_shared_map_code_cache() {
}
-void Code::MakeCodeAgeSequenceYoung(byte* sequence) {
- PatchPlatformCodeAge(sequence, kNoAge, NO_MARKING_PARITY);
+void Code::MakeCodeAgeSequenceYoung(Isolate* isolate, byte* sequence) {
+ PatchPlatformCodeAge(isolate, sequence, kNoAge, NO_MARKING_PARITY);
}
@@ -10488,7 +10488,9 @@ void Code::MakeOlder(MarkingParity current_parity) {
MarkingParity code_parity;
GetCodeAgeAndParity(sequence, &age, &code_parity);
if (age != kLastCodeAge && code_parity != current_parity) {
- PatchPlatformCodeAge(sequence, static_cast<Age>(age + 1),
+ PatchPlatformCodeAge(GetIsolate(),
+ sequence,
+ static_cast<Age>(age + 1),
current_parity);
}
}
@@ -10551,8 +10553,7 @@ void Code::GetCodeAgeAndParity(Code* code, Age* age,
}
-Code* Code::GetCodeAgeStub(Age age, MarkingParity parity) {
- Isolate* isolate = Isolate::Current();
+Code* Code::GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity
parity) {
Builtins* builtins = isolate->builtins();
switch (age) {
#define HANDLE_CODE_AGE(AGE) \
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
e7175cccb5a622a1aa6639ec67b92899cc8ff295..9c22c40f3f2091081430fa027cd3b4db444fdc15
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -5160,7 +5160,7 @@ class Code: public HeapObject {
// being entered through the prologue. Used to determine when it is
// relatively safe to flush this code object and replace it with the lazy
// compilation stub.
- static void MakeCodeAgeSequenceYoung(byte* sequence);
+ static void MakeCodeAgeSequenceYoung(Isolate* isolate, byte* sequence);
void MakeOlder(MarkingParity);
static bool IsYoungSequence(byte* sequence);
bool IsOld();
@@ -5306,10 +5306,11 @@ class Code: public HeapObject {
MarkingParity* parity);
static void GetCodeAgeAndParity(byte* sequence, Age* age,
MarkingParity* parity);
- static Code* GetCodeAgeStub(Age age, MarkingParity parity);
+ static Code* GetCodeAgeStub(Isolate* isolate, Age age, MarkingParity
parity);
// Code aging -- platform-specific
- static void PatchPlatformCodeAge(byte* sequence, Age age,
+ static void PatchPlatformCodeAge(Isolate* isolate,
+ byte* sequence, Age age,
MarkingParity parity);
DISALLOW_IMPLICIT_CONSTRUCTORS(Code);
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index
54dbce3410d881f72770eccce64aab7589f0d4ca..8cc8d7a1da01cf97b6952d933bfdac316e0c9ca3
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -14658,8 +14658,7 @@ const Runtime::Function*
Runtime::FunctionForId(Runtime::FunctionId id) {
}
-void Runtime::PerformGC(Object* result) {
- Isolate* isolate = Isolate::Current();
+void Runtime::PerformGC(Object* result, Isolate* isolate) {
Failure* failure = Failure::cast(result);
if (failure->IsRetryAfterGC()) {
if (isolate->heap()->new_space()->AddFreshPage()) {
Index: src/runtime.h
diff --git a/src/runtime.h b/src/runtime.h
index
4c7609844e2476de0991ae0576c052ab043041a4..efd57008484321772e90c169eac219cc5d9c8dc8
100644
--- a/src/runtime.h
+++ b/src/runtime.h
@@ -836,7 +836,7 @@ class Runtime : public AllStatic {
JSArrayBuffer* phantom_array_buffer);
// Helper functions used stubs.
- static void PerformGC(Object* result);
+ static void PerformGC(Object* result, Isolate* isolate);
// Used in runtime.cc and hydrogen's VisitArrayLiteral.
static Handle<Object> CreateArrayLiteralBoilerplate(
Index: src/x64/builtins-x64.cc
diff --git a/src/x64/builtins-x64.cc b/src/x64/builtins-x64.cc
index
4730ed14d59142c9fd3d532de071ccd4a1a8c99b..88a9a8bb6b13610eb6cb81a8f5a31b7fb57db82a
100644
--- a/src/x64/builtins-x64.cc
+++ b/src/x64/builtins-x64.cc
@@ -650,7 +650,9 @@ static void
GenerateMakeCodeYoungAgainCommon(MacroAssembler* masm) {
// the stub returns.
__ subq(Operand(rsp, 0), Immediate(5));
__ Pushad();
- __ movq(arg_reg_1, Operand(rsp, kNumSafepointRegisters * kPointerSize));
+ __ movq(arg_reg_2, Operand(rsp, kNumSafepointRegisters * kPointerSize));
+ __ movq(arg_reg_1,
+ ExternalReference::isolate_address(masm->isolate()));
{ // NOLINT
FrameScope scope(masm, StackFrame::MANUAL);
__ PrepareCallCFunction(1);
Index: src/x64/code-stubs-x64.cc
diff --git a/src/x64/code-stubs-x64.cc b/src/x64/code-stubs-x64.cc
index
d27b5fb2a29c28a3895eef7f929839a7aab8a5bb..75ea9c13997de560130c115990eafbbe9803c812
100644
--- a/src/x64/code-stubs-x64.cc
+++ b/src/x64/code-stubs-x64.cc
@@ -3619,6 +3619,7 @@ void CEntryStub::GenerateCore(MacroAssembler* masm,
// PerformGC. No need to use PrepareCallCFunction/CallCFunction here
as the
// stack is known to be aligned. This function takes one argument
which is
// passed in register.
+ __ movq(arg_reg_2,
ExternalReference::isolate_address(masm->isolate()));
__ movq(arg_reg_1, rax);
__ movq(kScratchRegister,
ExternalReference::perform_gc_function(masm->isolate()));
Index: src/x64/codegen-x64.cc
diff --git a/src/x64/codegen-x64.cc b/src/x64/codegen-x64.cc
index
ce69d15814139045e9f42e84f7259c48f347f843..ff01d0dd14d1ea1684deac809ea154bc8826a2d0
100644
--- a/src/x64/codegen-x64.cc
+++ b/src/x64/codegen-x64.cc
@@ -731,7 +731,8 @@ void Code::GetCodeAgeAndParity(byte* sequence, Age* age,
}
-void Code::PatchPlatformCodeAge(byte* sequence,
+void Code::PatchPlatformCodeAge(Isolate* isolate,
+ byte* sequence,
Code::Age age,
MarkingParity parity) {
uint32_t young_length;
@@ -740,7 +741,7 @@ void Code::PatchPlatformCodeAge(byte* sequence,
CopyBytes(sequence, young_sequence, young_length);
CPU::FlushICache(sequence, young_length);
} else {
- Code* stub = GetCodeAgeStub(age, parity);
+ Code* stub = GetCodeAgeStub(isolate, age, parity);
CodePatcher patcher(sequence, young_length);
patcher.masm()->call(stub->instruction_start());
for (int i = 0;
--
--
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/groups/opt_out.