Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1238)

Unified Diff: runtime/vm/stub_code.cc

Issue 1247783002: Make array allocation stub shared between isolates. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: runtime/vm/stub_code.cc
diff --git a/runtime/vm/stub_code.cc b/runtime/vm/stub_code.cc
index ad51097eadca0879c4cbbed0e24ee6a97866933d..4282dc4bc64638e853808c53192ce7df730320c8 100644
--- a/runtime/vm/stub_code.cc
+++ b/runtime/vm/stub_code.cc
@@ -38,14 +38,6 @@ void StubEntry::VisitObjectPointers(ObjectPointerVisitor* visitor) {
}
-StubCode::~StubCode() {
-#define STUB_CODE_DELETER(name) \
- delete name##_entry_;
- STUB_CODE_LIST(STUB_CODE_DELETER);
-#undef STUB_CODE_DELETER
-}
-
-
#define STUB_CODE_GENERATE(name) \
code ^= Generate("_stub_"#name, StubCode::Generate##name##Stub); \
name##_entry_ = new StubEntry(code);
@@ -58,48 +50,19 @@ void StubCode::InitOnce() {
}
-void StubCode::GenerateStubsFor(Isolate* init) {
- // Generate all the other stubs.
- Code& code = Code::Handle();
- STUB_CODE_LIST(STUB_CODE_GENERATE);
-}
-
#undef STUB_CODE_GENERATE
-void StubCode::Init(Isolate* isolate) {
- StubCode* stubs = new StubCode(isolate);
- isolate->set_stub_code(stubs);
- isolate->stub_code()->GenerateStubsFor(isolate);
-}
+void StubCode::Init(Isolate* isolate) { }
void StubCode::VisitObjectPointers(ObjectPointerVisitor* visitor) {
- // The current isolate is needed as part of the macro.
- Isolate* isolate = Isolate::Current();
- StubCode* stubs = isolate->stub_code();
- if (stubs == NULL) return;
- StubEntry* entry;
-#define STUB_CODE_VISIT_OBJECT_POINTER(name) \
- entry = stubs->name##_entry(); \
- if (entry != NULL) { \
- entry->VisitObjectPointers(visitor); \
- }
-
- STUB_CODE_LIST(STUB_CODE_VISIT_OBJECT_POINTER);
-#undef STUB_CODE_VISIT_OBJECT_POINTER
}
bool StubCode::InInvocationStub(uword pc) {
- return InInvocationStubForIsolate(Isolate::Current(), pc);
-}
-
-
-bool StubCode::InInvocationStubForIsolate(Isolate* isolate, uword pc) {
- StubCode* stub_code = isolate->stub_code();
- uword entry = stub_code->InvokeDartCodeEntryPoint();
- uword size = stub_code->InvokeDartCodeSize();
+ uword entry = StubCode::InvokeDartCodeEntryPoint();
+ uword size = StubCode::InvokeDartCodeSize();
return (pc >= entry) && (pc < (entry + size));
}
@@ -111,30 +74,21 @@ bool StubCode::InJumpToExceptionHandlerStub(uword pc) {
}
-RawCode* StubCode::GetAllocateArrayStub() {
- const Class& array_cls = Class::Handle(isolate_,
- isolate_->object_store()->array_class());
- return GetAllocationStubForClass(array_cls);
-}
-
-
RawCode* StubCode::GetAllocationStubForClass(const Class& cls) {
Isolate* isolate = Isolate::Current();
const Error& error = Error::Handle(isolate, cls.EnsureIsFinalized(isolate));
ASSERT(error.IsNull());
+ if (cls.id() == kArrayCid) {
+ return AllocateArray_entry()->code();
+ }
Code& stub = Code::Handle(isolate, cls.allocation_stub());
if (stub.IsNull()) {
Assembler assembler;
const char* name = cls.ToCString();
uword patch_code_offset = 0;
uword entry_patch_offset = 0;
- if (cls.id() == kArrayCid) {
- StubCode::GeneratePatchableAllocateArrayStub(
- &assembler, &entry_patch_offset, &patch_code_offset);
- } else {
- StubCode::GenerateAllocationStubForClass(
- &assembler, cls, &entry_patch_offset, &patch_code_offset);
- }
+ StubCode::GenerateAllocationStubForClass(
+ &assembler, cls, &entry_patch_offset, &patch_code_offset);
stub ^= Code::FinalizeCode(name, &assembler);
stub.set_owner(cls);
cls.set_allocation_stub(stub);
@@ -195,18 +149,7 @@ const char* StubCode::NameOfStub(uword entry_point) {
return ""#name; \
}
VM_STUB_CODE_LIST(VM_STUB_CODE_TESTER);
-
-#define STUB_CODE_TESTER(name) \
- if ((isolate->stub_code()->name##_entry() != NULL) && \
- (entry_point == isolate->stub_code()->name##EntryPoint())) { \
- return ""#name; \
- }
- Isolate* isolate = Isolate::Current();
- if ((isolate != NULL) && (isolate->stub_code() != NULL)) {
- STUB_CODE_LIST(STUB_CODE_TESTER);
- }
#undef VM_STUB_CODE_TESTER
-#undef STUB_CODE_TESTER
return NULL;
}

Powered by Google App Engine
This is Rietveld 408576698