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

Unified Diff: src/compiler/code-generator.cc

Issue 1181123002: [turbofan] Use RootIndexMap to speed up IsMaterializableFromRoot predicate. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Limit patch to TF 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
« 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/compiler/code-generator.cc
diff --git a/src/compiler/code-generator.cc b/src/compiler/code-generator.cc
index d19d21fa4a50f97707cef83542553534379e1889..59d1000113a8929545f77560554e31348fc1ea1e 100644
--- a/src/compiler/code-generator.cc
+++ b/src/compiler/code-generator.cc
@@ -7,6 +7,7 @@
#include "src/compiler/code-generator-impl.h"
#include "src/compiler/linkage.h"
#include "src/compiler/pipeline.h"
+#include "src/snapshot/serialize.h" // TODO(turbofan): RootIndexMap
namespace v8 {
namespace internal {
@@ -238,15 +239,11 @@ bool CodeGenerator::IsMaterializableFromFrame(Handle<HeapObject> object,
bool CodeGenerator::IsMaterializableFromRoot(
Handle<HeapObject> object, Heap::RootListIndex* index_return) {
if (linkage()->GetIncomingDescriptor()->IsJSFunctionCall()) {
- // Check if {object} is one of the non-smi roots that cannot be written
- // after initialization.
- for (int i = 0; i < Heap::kSmiRootsStart; ++i) {
- Heap::RootListIndex const index = static_cast<Heap::RootListIndex>(i);
- if (!Heap::RootCanBeWrittenAfterInitialization(index) &&
- *object == isolate()->heap()->root(index)) {
- *index_return = index;
- return true;
- }
+ RootIndexMap map(isolate());
+ int root_index = map.Lookup(*object);
+ if (root_index != RootIndexMap::kInvalidRootIndex) {
+ *index_return = static_cast<Heap::RootListIndex>(root_index);
+ return true;
}
}
return false;
« 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