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

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: Rebase 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
« no previous file with comments | « src/ast/ast-value-factory.h ('k') | src/ast/variables.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/ast-value-factory.cc
diff --git a/src/ast/ast-value-factory.cc b/src/ast/ast-value-factory.cc
index 29a6d951d1f4fa5f1dabdbc9adc13d26d3fdaf39..152dceecde8887927ae3c453e5fe794fc321f5a6 100644
--- a/src/ast/ast-value-factory.cc
+++ b/src/ast/ast-value-factory.cc
@@ -106,9 +106,9 @@ 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::kAllowed && !string_.is_null())
return string_->AsArrayIndex(index);
if (!is_one_byte() || literal_bytes_.length() == 0 ||
literal_bytes_.length() > String::kMaxArrayIndexSize)
@@ -136,11 +136,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;
}
@@ -276,6 +275,7 @@ void AstValueFactory::Internalize(Isolate* isolate) {
// Everything is already internalized.
return;
}
+
// Strings need to be internalized before values, because values refer to
// strings.
for (int i = 0; i < strings_.length(); ++i) {
« no previous file with comments | « src/ast/ast-value-factory.h ('k') | src/ast/variables.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698