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

Unified Diff: src/code-stubs.cc

Issue 6760001: Cleanup of FACTORY and HEAP macro usage in code-stubs.cc. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 9 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/code-stubs.cc
diff --git a/src/code-stubs.cc b/src/code-stubs.cc
index b370c65cc84575a3b5369628f650774ce622385e..cb3a3d7f88469e761ef8f23794c86720e8c7a4b9 100644
--- a/src/code-stubs.cc
+++ b/src/code-stubs.cc
@@ -37,9 +37,10 @@ namespace v8 {
namespace internal {
bool CodeStub::FindCodeInCache(Code** code_out) {
- int index = HEAP->code_stubs()->FindEntry(GetKey());
+ Heap* heap = Isolate::Current()->heap();
+ int index = heap->code_stubs()->FindEntry(GetKey());
if (index != NumberDictionary::kNotFound) {
- *code_out = Code::cast(HEAP->code_stubs()->ValueAt(index));
+ *code_out = Code::cast(heap->code_stubs()->ValueAt(index));
return true;
}
return false;
@@ -86,6 +87,9 @@ int CodeStub::GetCodeKind() {
Handle<Code> CodeStub::GetCode() {
+ Isolate* isolate = Isolate::Current();
+ Factory* factory = isolate->factory();
+ Heap* heap = isolate->heap();
Code* code;
if (!FindCodeInCache(&code)) {
v8::HandleScope scope;
Mads Ager (chromium) 2011/03/28 13:18:12 Use the isolate here as well.
@@ -103,23 +107,23 @@ Handle<Code> CodeStub::GetCode() {
static_cast<Code::Kind>(GetCodeKind()),
InLoop(),
GetICState());
- Handle<Code> new_object = FACTORY->NewCode(
+ Handle<Code> new_object = factory->NewCode(
desc, flags, masm.CodeObject(), NeedsImmovableCode());
RecordCodeGeneration(*new_object, &masm);
FinishCode(*new_object);
// Update the dictionary and the root in Heap.
Handle<NumberDictionary> dict =
- FACTORY->DictionaryAtNumberPut(
- Handle<NumberDictionary>(HEAP->code_stubs()),
+ factory->DictionaryAtNumberPut(
+ Handle<NumberDictionary>(heap->code_stubs()),
GetKey(),
new_object);
- HEAP->public_set_code_stubs(*dict);
+ heap->public_set_code_stubs(*dict);
code = *new_object;
}
- ASSERT(!NeedsImmovableCode() || HEAP->lo_space()->Contains(code));
+ ASSERT(!NeedsImmovableCode() || heap->lo_space()->Contains(code));
return Handle<Code>(code);
}
@@ -130,6 +134,7 @@ MaybeObject* CodeStub::TryGetCode() {
// Generate the new code.
MacroAssembler masm(NULL, 256);
GenerateCode(&masm);
+ Heap* heap = Isolate::Current()->heap();
Mads Ager (chromium) 2011/03/28 13:18:12 You can get the isolate from the macro assembler.
// Create the code object.
CodeDesc desc;
@@ -142,7 +147,7 @@ MaybeObject* CodeStub::TryGetCode() {
GetICState());
Object* new_object;
{ MaybeObject* maybe_new_object =
- HEAP->CreateCode(desc, flags, masm.CodeObject());
+ heap->CreateCode(desc, flags, masm.CodeObject());
if (!maybe_new_object->ToObject(&new_object)) return maybe_new_object;
}
code = Code::cast(new_object);
@@ -151,9 +156,9 @@ MaybeObject* CodeStub::TryGetCode() {
// Try to update the code cache but do not fail if unable.
MaybeObject* maybe_new_object =
- HEAP->code_stubs()->AtNumberPut(GetKey(), code);
+ heap->code_stubs()->AtNumberPut(GetKey(), code);
if (maybe_new_object->ToObject(&new_object)) {
- HEAP->public_set_code_stubs(NumberDictionary::cast(new_object));
+ heap->public_set_code_stubs(NumberDictionary::cast(new_object));
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698