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

Unified Diff: src/ast/ast-value-factory.cc

Issue 2223523002: [Interpreter] Avoid dereferencing handles on BytecodeGenerator for AST operations. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@offheap_const_array
Patch Set: Created 4 years, 4 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: src/ast/ast-value-factory.cc
diff --git a/src/ast/ast-value-factory.cc b/src/ast/ast-value-factory.cc
index 63b40d2286a82cbe1ff7a939eaf89b731c3870ff..9191e3b6ffb89d43cbd4739808db780afd86ad4e 100644
--- a/src/ast/ast-value-factory.cc
+++ b/src/ast/ast-value-factory.cc
@@ -93,9 +93,10 @@ void AstRawString::Internalize(Isolate* isolate) {
}
}
-
-bool AstRawString::AsArrayIndex(uint32_t* index) const {
- if (!string_.is_null())
+bool AstRawString::AsArrayIndex(uint32_t* index,
+ HandleDereferenceMode deref_mode) const {
+ if (deref_mode == HandleDereferenceMode::kHandleDereferenceAllowed &&
+ !string_.is_null())
return string_->AsArrayIndex(index);
if (!is_one_byte_ || literal_bytes_.length() == 0 ||
literal_bytes_.length() > String::kMaxArrayIndexSize)
@@ -123,11 +124,10 @@ void AstConsString::Internalize(Isolate* isolate) {
.ToHandleChecked();
}
-
-bool AstValue::IsPropertyName() const {
+bool AstValue::IsPropertyName(HandleDereferenceMode deref_mode) const {
if (type_ == STRING) {
uint32_t index;
- return !string_->AsArrayIndex(&index);
+ return !string_->AsArrayIndex(&index, deref_mode);
}
return false;
}
@@ -263,6 +263,13 @@ void AstValueFactory::Internalize(Isolate* isolate) {
// Everything is already internalized.
return;
}
+
+ // Create a canonical handle scope if compiling ignition bytecode. This is
+ // required by the constant array builder to de-duplicate common objects
+ // without dereferencing handles.
+ std::unique_ptr<CanonicalHandleScope> canonical;
+ if (FLAG_ignition) canonical.reset(new CanonicalHandleScope(isolate));
+
marja 2016/08/08 08:20:13 This code snippet seems to be on a wrong abstracti
rmcilroy 2016/08/08 13:05:56 Moved up to api.cc and compiler-dispatcher-job.cc.
// Strings need to be internalized before values, because values refer to
// strings.
for (int i = 0; i < strings_.length(); ++i) {

Powered by Google App Engine
This is Rietveld 408576698