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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1922523002: [Interpreter] Use FastCloneShallowObjectStub in CreateObjectLiteral bytecode. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add todo Created 4 years, 8 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/full-codegen/full-codegen.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index af7b9158e2e3d77e013c47f1db75366229e37acb..324d7b99b8ee807bcee65666c1ee288b6a2a9f6a 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -5,6 +5,7 @@
#include "src/interpreter/bytecode-generator.h"
#include "src/ast/scopes.h"
+#include "src/code-stubs.h"
#include "src/compiler.h"
#include "src/interpreter/bytecode-register-allocator.h"
#include "src/interpreter/control-flow-builders.h"
@@ -1596,10 +1597,21 @@ void BytecodeGenerator::VisitRegExpLiteral(RegExpLiteral* expr) {
void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
- // Deep-copy the literal boilerplate.
+ // Copy the literal boilerplate.
+ int fast_clone_properties_count = 0;
+ if (FastCloneShallowObjectStub::IsSupported(expr)) {
+ STATIC_ASSERT(
+ FastCloneShallowObjectStub::kMaximumClonedProperties <=
+ 1 << CreateObjectLiteralFlags::FastClonePropertiesCountBits::kShift);
+ fast_clone_properties_count =
+ FastCloneShallowObjectStub::PropertiesCount(expr->properties_count());
+ }
+ uint8_t flags =
+ CreateObjectLiteralFlags::FlagsBits::encode(expr->ComputeFlags()) |
+ CreateObjectLiteralFlags::FastClonePropertiesCountBits::encode(
+ fast_clone_properties_count);
builder()->CreateObjectLiteral(expr->constant_properties(),
- expr->literal_index(),
- expr->ComputeFlags(true));
+ expr->literal_index(), flags);
// Allocate in the outer scope since this register is used to return the
// expression's results to the caller.
« no previous file with comments | « src/full-codegen/full-codegen.cc ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698