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

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

Issue 2579973002: Don't compile inner functions when compiling via the dispatcher (Closed)
Patch Set: added comment Created 4 years 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/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 9b31c13107e4a94c30c9f9ad4ee6ef9e64db9939..141d9ed3b68f3b2db05ec14c978d8ddaf50e11f1 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -491,10 +491,11 @@ class BytecodeGenerator::TestResultScope final : public ExpressionResultScope {
// Used to build a list of global declaration initial value pairs.
class BytecodeGenerator::GlobalDeclarationsBuilder final : public ZoneObject {
public:
- explicit GlobalDeclarationsBuilder(Zone* zone)
+ GlobalDeclarationsBuilder(Zone* zone, LazyCompilationMode mode)
: declarations_(0, zone),
constant_pool_entry_(0),
- has_constant_pool_entry_(false) {}
+ has_constant_pool_entry_(false),
+ compilation_mode_(mode) {}
void AddFunctionDeclaration(Handle<String> name, FeedbackVectorSlot slot,
FunctionLiteral* func) {
@@ -518,8 +519,8 @@ class BytecodeGenerator::GlobalDeclarationsBuilder final : public ZoneObject {
if (func == nullptr) {
initial_value = info->isolate()->factory()->undefined_value();
} else {
- initial_value =
- Compiler::GetSharedFunctionInfo(func, info->script(), info);
+ initial_value = Compiler::GetSharedFunctionInfo(
+ func, info->script(), info, compilation_mode_);
}
// Return a null handle if any initial values can't be created. Caller
@@ -561,9 +562,11 @@ class BytecodeGenerator::GlobalDeclarationsBuilder final : public ZoneObject {
ZoneVector<Declaration> declarations_;
size_t constant_pool_entry_;
bool has_constant_pool_entry_;
+ LazyCompilationMode compilation_mode_;
};
-BytecodeGenerator::BytecodeGenerator(CompilationInfo* info)
+BytecodeGenerator::BytecodeGenerator(CompilationInfo* info,
+ LazyCompilationMode mode)
: zone_(info->zone()),
builder_(new (zone()) BytecodeArrayBuilder(
info->isolate(), info->zone(), info->num_parameters_including_this(),
@@ -572,7 +575,9 @@ BytecodeGenerator::BytecodeGenerator(CompilationInfo* info)
info->SourcePositionRecordingMode())),
info_(info),
scope_(info->scope()),
- globals_builder_(new (zone()) GlobalDeclarationsBuilder(info->zone())),
+ compilation_mode_(mode),
+ globals_builder_(new (zone())
+ GlobalDeclarationsBuilder(info->zone(), mode)),
global_declarations_(0, info->zone()),
function_literals_(0, info->zone()),
native_function_literals_(0, info->zone()),
@@ -611,8 +616,8 @@ void BytecodeGenerator::AllocateDeferredConstants() {
// Find or build shared function infos.
for (std::pair<FunctionLiteral*, size_t> literal : function_literals_) {
FunctionLiteral* expr = literal.first;
- Handle<SharedFunctionInfo> shared_info =
- Compiler::GetSharedFunctionInfo(expr, info()->script(), info());
+ Handle<SharedFunctionInfo> shared_info = Compiler::GetSharedFunctionInfo(
+ expr, info()->script(), info(), compilation_mode_);
if (shared_info.is_null()) return SetStackOverflow();
builder()->InsertConstantPoolEntryAt(literal.second, shared_info);
}
@@ -949,7 +954,8 @@ void BytecodeGenerator::VisitDeclarations(Declaration::List* declarations) {
// Push and reset globals builder.
global_declarations_.push_back(globals_builder());
- globals_builder_ = new (zone()) GlobalDeclarationsBuilder(zone());
+ globals_builder_ =
+ new (zone()) GlobalDeclarationsBuilder(zone(), compilation_mode_);
}
void BytecodeGenerator::VisitStatements(ZoneList<Statement*>* statements) {

Powered by Google App Engine
This is Rietveld 408576698