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

Unified Diff: src/stub-cache.cc

Issue 6770011: Cleanup usage of HEAP and FACTORY in the cache stub compiler. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Minor reformatting. 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 | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/stub-cache.cc
diff --git a/src/stub-cache.cc b/src/stub-cache.cc
index cd198e2f07f18ea0fff30f5ca2db0ceec42ceac6..435e71d1614491c7a1a9238ad4a056c37577fb27 100644
--- a/src/stub-cache.cc
+++ b/src/stub-cache.cc
@@ -64,7 +64,7 @@ Code* StubCache::Set(String* name, Map* map, Code* code) {
// Validate that the name does not move on scavenge, and that we
// can use identity checks instead of string equality checks.
- ASSERT(!isolate_->heap()->InNewSpace(name));
+ ASSERT(!heap()->InNewSpace(name));
ASSERT(name->IsSymbol());
// The state bits are not important to the hash function because
@@ -108,10 +108,10 @@ MaybeObject* StubCache::ComputeLoadNonexistent(String* name,
// there are global objects involved, we need to check global
// property cells in the stub and therefore the stub will be
// specific to the name.
- String* cache_name = isolate_->heap()->empty_string();
+ String* cache_name = heap()->empty_string();
if (receiver->IsGlobalObject()) cache_name = name;
JSObject* last = receiver;
- while (last->GetPrototype() != isolate_->heap()->null_value()) {
+ while (last->GetPrototype() != heap()->null_value()) {
last = JSObject::cast(last->GetPrototype());
if (last->IsGlobalObject()) cache_name = name;
}
@@ -466,7 +466,7 @@ MaybeObject* StubCache::ComputeKeyedLoadSpecialized(JSObject* receiver) {
// keyed loads that are not array elements go through a generic builtin stub.
Code::Flags flags =
Code::ComputeMonomorphicFlags(Code::KEYED_LOAD_IC, NORMAL);
- String* name = isolate_->heap()->KeyedLoadSpecialized_symbol();
+ String* name = heap()->KeyedLoadSpecialized_symbol();
Object* code = receiver->map()->FindInCodeCache(name, flags);
if (code->IsUndefined()) {
KeyedLoadStubCompiler compiler;
@@ -518,7 +518,7 @@ MaybeObject* StubCache::ComputeKeyedStoreSpecialized(
StrictModeFlag strict_mode) {
Code::Flags flags =
Code::ComputeMonomorphicFlags(Code::KEYED_STORE_IC, NORMAL, strict_mode);
- String* name = isolate_->heap()->KeyedStoreSpecialized_symbol();
+ String* name = heap()->KeyedStoreSpecialized_symbol();
Object* code = receiver->map()->FindInCodeCache(name, flags);
if (code->IsUndefined()) {
KeyedStoreStubCompiler compiler(strict_mode);
@@ -563,26 +563,27 @@ ExternalArrayType ElementsKindToExternalArrayType(JSObject::ElementsKind kind) {
}
}
-String* ExternalArrayTypeToStubName(ExternalArrayType array_type,
+String* ExternalArrayTypeToStubName(Heap* heap,
+ ExternalArrayType array_type,
bool is_store) {
if (is_store) {
switch (array_type) {
case kExternalByteArray:
- return HEAP->KeyedStoreExternalByteArray_symbol();
+ return heap->KeyedStoreExternalByteArray_symbol();
case kExternalUnsignedByteArray:
- return HEAP->KeyedStoreExternalUnsignedByteArray_symbol();
+ return heap->KeyedStoreExternalUnsignedByteArray_symbol();
case kExternalShortArray:
- return HEAP->KeyedStoreExternalShortArray_symbol();
+ return heap->KeyedStoreExternalShortArray_symbol();
case kExternalUnsignedShortArray:
- return HEAP->KeyedStoreExternalUnsignedShortArray_symbol();
+ return heap->KeyedStoreExternalUnsignedShortArray_symbol();
case kExternalIntArray:
- return HEAP->KeyedStoreExternalIntArray_symbol();
+ return heap->KeyedStoreExternalIntArray_symbol();
case kExternalUnsignedIntArray:
- return HEAP->KeyedStoreExternalUnsignedIntArray_symbol();
+ return heap->KeyedStoreExternalUnsignedIntArray_symbol();
case kExternalFloatArray:
- return HEAP->KeyedStoreExternalFloatArray_symbol();
+ return heap->KeyedStoreExternalFloatArray_symbol();
case kExternalPixelArray:
- return HEAP->KeyedStoreExternalPixelArray_symbol();
+ return heap->KeyedStoreExternalPixelArray_symbol();
default:
UNREACHABLE();
return NULL;
@@ -590,21 +591,21 @@ String* ExternalArrayTypeToStubName(ExternalArrayType array_type,
} else {
switch (array_type) {
case kExternalByteArray:
- return HEAP->KeyedLoadExternalByteArray_symbol();
+ return heap->KeyedLoadExternalByteArray_symbol();
case kExternalUnsignedByteArray:
- return HEAP->KeyedLoadExternalUnsignedByteArray_symbol();
+ return heap->KeyedLoadExternalUnsignedByteArray_symbol();
case kExternalShortArray:
- return HEAP->KeyedLoadExternalShortArray_symbol();
+ return heap->KeyedLoadExternalShortArray_symbol();
case kExternalUnsignedShortArray:
- return HEAP->KeyedLoadExternalUnsignedShortArray_symbol();
+ return heap->KeyedLoadExternalUnsignedShortArray_symbol();
case kExternalIntArray:
- return HEAP->KeyedLoadExternalIntArray_symbol();
+ return heap->KeyedLoadExternalIntArray_symbol();
case kExternalUnsignedIntArray:
- return HEAP->KeyedLoadExternalUnsignedIntArray_symbol();
+ return heap->KeyedLoadExternalUnsignedIntArray_symbol();
case kExternalFloatArray:
- return HEAP->KeyedLoadExternalFloatArray_symbol();
+ return heap->KeyedLoadExternalFloatArray_symbol();
case kExternalPixelArray:
- return HEAP->KeyedLoadExternalPixelArray_symbol();
+ return heap->KeyedLoadExternalPixelArray_symbol();
default:
UNREACHABLE();
return NULL;
@@ -627,7 +628,7 @@ MaybeObject* StubCache::ComputeKeyedLoadOrStoreExternalArray(
strict_mode);
ExternalArrayType array_type =
ElementsKindToExternalArrayType(receiver->GetElementsKind());
- String* name = ExternalArrayTypeToStubName(array_type, is_store);
+ String* name = ExternalArrayTypeToStubName(heap(), array_type, is_store);
Object* code = receiver->map()->FindInCodeCache(name, flags);
if (code->IsUndefined()) {
ExternalArrayStubCompiler compiler;
@@ -759,7 +760,7 @@ MaybeObject* StubCache::ComputeKeyedStoreField(String* name,
compiler.CompileStoreField(receiver, field_index, transition, name);
if (!maybe_code->ToObject(&code)) return maybe_code;
}
- PROFILE(isolate_,
+ PROFILE(isolate(),
CodeCreateEvent(Logger::KEYED_STORE_IC_TAG,
Code::cast(code), name));
GDBJIT(AddCode(GDBJITInterface::KEYED_STORE_IC, name, Code::cast(code)));
@@ -917,7 +918,7 @@ MaybeObject* StubCache::ComputeCallInterceptor(int argc,
if (!maybe_code->ToObject(&code)) return maybe_code;
}
ASSERT_EQ(flags, Code::cast(code)->flags());
- PROFILE(isolate_,
+ PROFILE(isolate(),
CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
Code::cast(code), name));
GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
@@ -975,7 +976,7 @@ MaybeObject* StubCache::ComputeCallGlobal(int argc,
if (!maybe_code->ToObject(&code)) return maybe_code;
}
ASSERT_EQ(flags, Code::cast(code)->flags());
- PROFILE(isolate_,
+ PROFILE(isolate(),
CodeCreateEvent(CALL_LOGGER_TAG(kind, CALL_IC_TAG),
Code::cast(code), name));
GDBJIT(AddCode(GDBJITInterface::CALL_IC, name, Code::cast(code)));
@@ -1046,8 +1047,8 @@ Code* StubCache::FindCallInitialize(int argc,
Code::kNoExtraICState,
NORMAL,
argc);
- Object* result = ProbeCache(isolate_, flags)->ToObjectUnchecked();
- ASSERT(result != isolate_->heap()->undefined_value());
+ Object* result = ProbeCache(isolate(), flags)->ToObjectUnchecked();
+ ASSERT(result != heap()->undefined_value());
// This might be called during the marking phase of the collector
// hence the unchecked cast.
return reinterpret_cast<Code*>(result);
@@ -1219,12 +1220,12 @@ MaybeObject* StubCache::ComputeCallDebugPrepareStepIn(int argc,
void StubCache::Clear() {
for (int i = 0; i < kPrimaryTableSize; i++) {
- primary_[i].key = isolate_->heap()->empty_string();
+ primary_[i].key = heap()->empty_string();
primary_[i].value = isolate_->builtins()->builtin(
Builtins::kIllegal);
}
for (int j = 0; j < kSecondaryTableSize; j++) {
- secondary_[j].key = isolate_->heap()->empty_string();
+ secondary_[j].key = heap()->empty_string();
secondary_[j].value = isolate_->builtins()->builtin(
Builtins::kIllegal);
}
@@ -1668,7 +1669,7 @@ MaybeObject* StubCompiler::GetCodeWithFlags(Code::Flags flags,
// Create code object in the heap.
CodeDesc desc;
masm_.GetCode(&desc);
- MaybeObject* result = HEAP->CreateCode(desc, flags, masm_.CodeObject());
+ MaybeObject* result = heap()->CreateCode(desc, flags, masm_.CodeObject());
#ifdef ENABLE_DISASSEMBLER
if (FLAG_print_code_stubs && !result->IsFailure()) {
Code::cast(result->ToObjectUnchecked())->Disassemble(name);
« no previous file with comments | « src/stub-cache.h ('k') | src/x64/stub-cache-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698