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

Unified Diff: src/objects.cc

Issue 1205783003: Simplify interface to optimized code map lookup. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@local_opt-code-map-1
Patch Set: Created 5 years, 6 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
« src/factory.cc ('K') | « src/objects.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/objects.cc
diff --git a/src/objects.cc b/src/objects.cc
index dde6179007ef8519e4c02f87b768a0037d539d67..4c32fc52713b9b66f52c9ac2d7485745ab92ff79 100644
--- a/src/objects.cc
+++ b/src/objects.cc
@@ -9590,7 +9590,7 @@ void SharedFunctionInfo::AddToOptimizedCodeMap(
} else {
// Copy old map and append one new entry.
Handle<FixedArray> old_code_map = Handle<FixedArray>::cast(value);
- DCHECK_EQ(-1, shared->SearchOptimizedCodeMap(*native_context, osr_ast_id));
+ DCHECK(!shared->SearchOptimizedCodeMap(*native_context, osr_ast_id).code);
old_length = old_code_map->length();
new_code_map = FixedArray::CopySize(
old_code_map, old_length + kEntryLength);
@@ -9620,24 +9620,6 @@ void SharedFunctionInfo::AddToOptimizedCodeMap(
}
-FixedArray* SharedFunctionInfo::GetLiteralsFromOptimizedCodeMap(int index) {
- DCHECK(index > kEntriesStart);
- FixedArray* code_map = FixedArray::cast(optimized_code_map());
- FixedArray* cached_literals = FixedArray::cast(code_map->get(index + 1));
- DCHECK_NOT_NULL(cached_literals);
- return cached_literals;
-}
-
-
-Code* SharedFunctionInfo::GetCodeFromOptimizedCodeMap(int index) {
- DCHECK(index > kEntriesStart);
- FixedArray* code_map = FixedArray::cast(optimized_code_map());
- Code* code = Code::cast(code_map->get(index));
- DCHECK_NOT_NULL(code);
- return code;
-}
-
-
void SharedFunctionInfo::ClearOptimizedCodeMap() {
FixedArray* code_map = FixedArray::cast(optimized_code_map());
@@ -10612,11 +10594,11 @@ void SharedFunctionInfo::ResetForNewContext(int new_ic_age) {
}
-int SharedFunctionInfo::SearchOptimizedCodeMap(Context* native_context,
- BailoutId osr_ast_id) {
+CodeAndLiterals SharedFunctionInfo::SearchOptimizedCodeMap(
+ Context* native_context, BailoutId osr_ast_id) {
DisallowHeapAllocation no_gc;
DCHECK(native_context->IsNativeContext());
- if (!FLAG_cache_optimized_code) return -1;
+ if (!FLAG_cache_optimized_code) return {nullptr, nullptr};
Object* value = optimized_code_map();
if (!value->IsSmi()) {
FixedArray* optimized_code_map = FixedArray::cast(value);
@@ -10625,7 +10607,8 @@ int SharedFunctionInfo::SearchOptimizedCodeMap(Context* native_context,
for (int i = kEntriesStart; i < length; i += kEntryLength) {
if (optimized_code_map->get(i + kContextOffset) == native_context &&
optimized_code_map->get(i + kOsrAstIdOffset) == osr_ast_id_smi) {
- return i + kCachedCodeOffset;
+ return {Code::cast(optimized_code_map->get(i + kCachedCodeOffset)),
jochen (gone - plz use gerrit) 2015/07/13 07:11:50 fyi, this syntax is forbidden by chromium's C++ st
Michael Starzinger 2015/07/13 07:43:31 Can we haz presubmit check then?
+ FixedArray::cast(optimized_code_map->get(i + kLiteralsOffset))};
}
}
if (FLAG_trace_opt) {
@@ -10634,7 +10617,7 @@ int SharedFunctionInfo::SearchOptimizedCodeMap(Context* native_context,
PrintF("]\n");
}
}
- return -1;
+ return {nullptr, nullptr};
}
« src/factory.cc ('K') | « src/objects.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698