Commit bbcafaa2 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Make sure we don't flush the pregenerated stubs, since they need

to be always present, so that we can call them from other stubs
without trying to generate stubs while we are generating stubs.
Review URL: http://codereview.chromium.org/8052029

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9459 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 8e5db73e
...@@ -877,8 +877,8 @@ bool WriteInt32ToHeapNumberStub::IsPregenerated() { ...@@ -877,8 +877,8 @@ bool WriteInt32ToHeapNumberStub::IsPregenerated() {
void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime() { void WriteInt32ToHeapNumberStub::GenerateFixedRegStubsAheadOfTime() {
WriteInt32ToHeapNumberStub stub1(r1, r0, r2); WriteInt32ToHeapNumberStub stub1(r1, r0, r2);
WriteInt32ToHeapNumberStub stub2(r2, r0, r3); WriteInt32ToHeapNumberStub stub2(r2, r0, r3);
Handle<Code> code1 = stub1.GetCode(); Handle<Code> code1 = stub1.GetCode()->set_is_pregenerated(true);
Handle<Code> code2 = stub2.GetCode(); Handle<Code> code2 = stub2.GetCode()->set_is_pregenerated(true);
} }
...@@ -3413,7 +3413,7 @@ void CodeStub::GenerateStubsAheadOfTime() { ...@@ -3413,7 +3413,7 @@ void CodeStub::GenerateStubsAheadOfTime() {
void CodeStub::GenerateFPStubs() { void CodeStub::GenerateFPStubs() {
CEntryStub save_doubles(1, kSaveFPRegs); CEntryStub save_doubles(1, kSaveFPRegs);
Handle<Code> code = save_doubles.GetCode(); Handle<Code> code = save_doubles.GetCode()->set_is_pregenerated(true);
code->GetIsolate()->set_fp_stubs_generated(true); code->GetIsolate()->set_fp_stubs_generated(true);
} }
...@@ -6877,9 +6877,9 @@ bool RecordWriteStub::IsPregenerated() { ...@@ -6877,9 +6877,9 @@ bool RecordWriteStub::IsPregenerated() {
void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() { void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() {
StoreBufferOverflowStub stub1(kDontSaveFPRegs); StoreBufferOverflowStub stub1(kDontSaveFPRegs);
stub1.GetCode(); stub1.GetCode()->set_is_pregenerated(true);
StoreBufferOverflowStub stub2(kSaveFPRegs); StoreBufferOverflowStub stub2(kSaveFPRegs);
stub2.GetCode(); stub2.GetCode()->set_is_pregenerated(true);
} }
...@@ -6892,7 +6892,7 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { ...@@ -6892,7 +6892,7 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() {
entry->address, entry->address,
entry->action, entry->action,
kDontSaveFPRegs); kDontSaveFPRegs);
stub.GetCode(); stub.GetCode()->set_is_pregenerated(true);
} }
} }
......
...@@ -4424,6 +4424,7 @@ void CodeStub::GenerateStubsAheadOfTime() { ...@@ -4424,6 +4424,7 @@ void CodeStub::GenerateStubsAheadOfTime() {
void CodeStub::GenerateFPStubs() { void CodeStub::GenerateFPStubs() {
CEntryStub save_doubles(1, kSaveFPRegs); CEntryStub save_doubles(1, kSaveFPRegs);
Handle<Code> code = save_doubles.GetCode(); Handle<Code> code = save_doubles.GetCode();
code->set_is_pregenerated(true);
code->GetIsolate()->set_fp_stubs_generated(true); code->GetIsolate()->set_fp_stubs_generated(true);
} }
...@@ -6667,7 +6668,7 @@ struct AheadOfTimeWriteBarrierStubList kAheadOfTime[] = { ...@@ -6667,7 +6668,7 @@ struct AheadOfTimeWriteBarrierStubList kAheadOfTime[] = {
{ ebx, eax, edi, EMIT_REMEMBERED_SET }, { ebx, eax, edi, EMIT_REMEMBERED_SET },
// Used in CompileArrayPushCall. // Used in CompileArrayPushCall.
{ ebx, ecx, edx, EMIT_REMEMBERED_SET }, { ebx, ecx, edx, EMIT_REMEMBERED_SET },
// Used in CompileStoreGlobal. // Used in CompileStoreGlobal and CallFunctionStub.
{ ebx, ecx, edx, OMIT_REMEMBERED_SET }, { ebx, ecx, edx, OMIT_REMEMBERED_SET },
// Used in StoreStubCompiler::CompileStoreField and // Used in StoreStubCompiler::CompileStoreField and
// KeyedStoreStubCompiler::CompileStoreField via GenerateStoreField. // KeyedStoreStubCompiler::CompileStoreField via GenerateStoreField.
...@@ -6704,12 +6705,12 @@ bool RecordWriteStub::IsPregenerated() { ...@@ -6704,12 +6705,12 @@ bool RecordWriteStub::IsPregenerated() {
void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() { void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() {
StoreBufferOverflowStub stub1(kDontSaveFPRegs); StoreBufferOverflowStub stub1(kDontSaveFPRegs);
stub1.GetCode(); stub1.GetCode()->set_is_pregenerated(true);
CpuFeatures::TryForceFeatureScope scope(SSE2); CpuFeatures::TryForceFeatureScope scope(SSE2);
if (CpuFeatures::IsSupported(SSE2)) { if (CpuFeatures::IsSupported(SSE2)) {
StoreBufferOverflowStub stub2(kSaveFPRegs); StoreBufferOverflowStub stub2(kSaveFPRegs);
stub2.GetCode(); stub2.GetCode()->set_is_pregenerated(true);
} }
} }
...@@ -6723,7 +6724,7 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { ...@@ -6723,7 +6724,7 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() {
entry->address, entry->address,
entry->action, entry->action,
kDontSaveFPRegs); kDontSaveFPRegs);
stub.GetCode(); stub.GetCode()->set_is_pregenerated(true);
} }
} }
......
...@@ -1768,7 +1768,7 @@ bool Isolate::Init(Deserializer* des) { ...@@ -1768,7 +1768,7 @@ bool Isolate::Init(Deserializer* des) {
// If we are deserializing, read the state into the now-empty heap. // If we are deserializing, read the state into the now-empty heap.
if (des != NULL) { if (des != NULL) {
des->Deserialize(); des->Deserialize();
stub_cache_->Clear(); stub_cache_->Initialize(true);
} }
// Deserializing may put strange things in the root array's copy of the // Deserializing may put strange things in the root array's copy of the
......
...@@ -2935,6 +2935,19 @@ void Code::set_major_key(int major) { ...@@ -2935,6 +2935,19 @@ void Code::set_major_key(int major) {
} }
bool Code::is_pregenerated() {
return kind() == STUB && IsPregeneratedField::decode(flags());
}
void Code::set_is_pregenerated(bool value) {
ASSERT(kind() == STUB);
Flags f = flags();
f = static_cast<Flags>(IsPregeneratedField::update(f, value));
set_flags(f);
}
bool Code::optimizable() { bool Code::optimizable() {
ASSERT(kind() == FUNCTION); ASSERT(kind() == FUNCTION);
return READ_BYTE_FIELD(this, kOptimizableOffset) == 1; return READ_BYTE_FIELD(this, kOptimizableOffset) == 1;
......
...@@ -3657,6 +3657,11 @@ class Code: public HeapObject { ...@@ -3657,6 +3657,11 @@ class Code: public HeapObject {
inline int major_key(); inline int major_key();
inline void set_major_key(int value); inline void set_major_key(int value);
// For stubs, tells whether they should always exist, so that they can be
// called from other stubs.
inline bool is_pregenerated();
inline void set_is_pregenerated(bool value);
// [optimizable]: For FUNCTION kind, tells if it is optimizable. // [optimizable]: For FUNCTION kind, tells if it is optimizable.
inline bool optimizable(); inline bool optimizable();
inline void set_optimizable(bool value); inline void set_optimizable(bool value);
...@@ -3880,6 +3885,7 @@ class Code: public HeapObject { ...@@ -3880,6 +3885,7 @@ class Code: public HeapObject {
class KindField: public BitField<Kind, 7, 4> {}; class KindField: public BitField<Kind, 7, 4> {};
class CacheHolderField: public BitField<InlineCacheHolderFlag, 11, 1> {}; class CacheHolderField: public BitField<InlineCacheHolderFlag, 11, 1> {};
class ExtraICStateField: public BitField<ExtraICState, 12, 2> {}; class ExtraICStateField: public BitField<ExtraICState, 12, 2> {};
class IsPregeneratedField: public BitField<bool, 14, 1> {};
// Signed field cannot be encoded using the BitField class. // Signed field cannot be encoded using the BitField class.
static const int kArgumentsCountShift = 14; static const int kArgumentsCountShift = 14;
......
...@@ -55,7 +55,15 @@ void StubCache::Initialize(bool create_heap_objects) { ...@@ -55,7 +55,15 @@ void StubCache::Initialize(bool create_heap_objects) {
ASSERT(IsPowerOf2(kSecondaryTableSize)); ASSERT(IsPowerOf2(kSecondaryTableSize));
if (create_heap_objects) { if (create_heap_objects) {
HandleScope scope; HandleScope scope;
Clear(); Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal);
for (int i = 0; i < kPrimaryTableSize; i++) {
primary_[i].key = heap()->empty_string();
primary_[i].value = empty;
}
for (int j = 0; j < kSecondaryTableSize; j++) {
secondary_[j].key = heap()->empty_string();
secondary_[j].value = empty;
}
} }
} }
...@@ -1099,15 +1107,20 @@ MaybeObject* StubCache::ComputeCallDebugPrepareStepIn( ...@@ -1099,15 +1107,20 @@ MaybeObject* StubCache::ComputeCallDebugPrepareStepIn(
void StubCache::Clear() { void StubCache::Clear() {
Code* empty = isolate_->builtins()->builtin(Builtins::kIllegal);
for (int i = 0; i < kPrimaryTableSize; i++) { for (int i = 0; i < kPrimaryTableSize; i++) {
primary_[i].key = heap()->empty_string(); Code* code = primary_[i].value;
primary_[i].value = isolate_->builtins()->builtin( if (code != empty && !code->is_pregenerated()) {
Builtins::kIllegal); primary_[i].key = heap()->empty_string();
primary_[i].value = empty;
}
} }
for (int j = 0; j < kSecondaryTableSize; j++) { for (int j = 0; j < kSecondaryTableSize; j++) {
secondary_[j].key = heap()->empty_string(); Code* code = secondary_[j].value;
secondary_[j].value = isolate_->builtins()->builtin( if (code != empty && !code->is_pregenerated()) {
Builtins::kIllegal); secondary_[j].key = heap()->empty_string();
secondary_[j].value = empty;
}
} }
} }
......
...@@ -3376,7 +3376,7 @@ bool CEntryStub::IsPregenerated() { ...@@ -3376,7 +3376,7 @@ bool CEntryStub::IsPregenerated() {
void CodeStub::GenerateStubsAheadOfTime() { void CodeStub::GenerateStubsAheadOfTime() {
CEntryStub save_doubles(1, kSaveFPRegs); CEntryStub save_doubles(1, kSaveFPRegs);
save_doubles.GetCode(); save_doubles.GetCode()->set_is_pregenerated(true);
StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime(); StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime();
// It is important that the store buffer overflow stubs are generated first. // It is important that the store buffer overflow stubs are generated first.
RecordWriteStub::GenerateFixedRegStubsAheadOfTime(); RecordWriteStub::GenerateFixedRegStubsAheadOfTime();
...@@ -5616,9 +5616,9 @@ bool RecordWriteStub::IsPregenerated() { ...@@ -5616,9 +5616,9 @@ bool RecordWriteStub::IsPregenerated() {
void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() { void StoreBufferOverflowStub::GenerateFixedRegStubsAheadOfTime() {
StoreBufferOverflowStub stub1(kDontSaveFPRegs); StoreBufferOverflowStub stub1(kDontSaveFPRegs);
stub1.GetCode(); stub1.GetCode()->set_is_pregenerated(true);
StoreBufferOverflowStub stub2(kSaveFPRegs); StoreBufferOverflowStub stub2(kSaveFPRegs);
stub2.GetCode(); stub2.GetCode()->set_is_pregenerated(true);
} }
...@@ -5631,7 +5631,7 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() { ...@@ -5631,7 +5631,7 @@ void RecordWriteStub::GenerateFixedRegStubsAheadOfTime() {
entry->address, entry->address,
entry->action, entry->action,
kDontSaveFPRegs); kDontSaveFPRegs);
stub.GetCode(); stub.GetCode()->set_is_pregenerated(true);
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment