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

Unified Diff: src/asmjs/asm-typer.cc

Issue 2553033002: [wasm] [asm.js] Avoid expensive GetLineNumber up front in asm-typer. (Closed)
Patch Set: 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
« no previous file with comments | « src/asmjs/asm-typer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/asmjs/asm-typer.cc
diff --git a/src/asmjs/asm-typer.cc b/src/asmjs/asm-typer.cc
index 2848e4af725419e39c8109a5c8dad1cbfc030917..70b7a5929f2b1c18da984ca9d03514c74abe2fa8 100644
--- a/src/asmjs/asm-typer.cc
+++ b/src/asmjs/asm-typer.cc
@@ -189,8 +189,6 @@ AsmTyper::AsmTyper(Isolate* isolate, Zone* zone, Script* script,
local_scope_(ZoneHashMap::kDefaultHashMapCapacity,
ZoneAllocationPolicy(zone)),
stack_limit_(isolate->stack_guard()->real_climit()),
- module_node_types_(zone_),
- function_node_types_(zone_),
fround_type_(AsmType::FroundType(zone_)),
ffi_type_(AsmType::FFIType(zone_)),
function_pointer_tables_(zone_) {
@@ -399,9 +397,7 @@ AsmTyper::VariableInfo* AsmTyper::Lookup(Variable* variable) const {
}
void AsmTyper::AddForwardReference(VariableProxy* proxy, VariableInfo* info) {
- info->SetFirstForwardUse(proxy->position() == kNoSourcePosition
- ? -1
- : script_->GetLineNumber(proxy->position()));
+ info->SetFirstForwardUse(proxy->position());
forward_definitions_.push_back(info);
}
@@ -709,8 +705,11 @@ AsmType* AsmTyper::ValidateModuleAfterFunctionsPhase(FunctionLiteral* fun) {
for (auto* forward_def : forward_definitions_) {
if (forward_def->missing_definition()) {
- FAIL_LINE(forward_def->source_location(),
- "Missing definition for forward declared identifier.");
+ int position = forward_def->source_location();
+ int line =
+ position == kNoSourcePosition ? -1 : script_->GetLineNumber(position);
+
+ FAIL_LINE(line, "Missing definition for forward declared identifier.");
}
}
« no previous file with comments | « src/asmjs/asm-typer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698