[parser] Name outer promise ".promise" in the desugaring.

The Parser inserts a temporary .promise variable to hold the outer
promise for async functions, but doesn't assign an actually visible
name to it. This change puts the name ".promise" on it (similar to
what we do for other special variables like .result), which makes it
easier to debug this (for V8 developers). It's not observable to
regular developers.

Bug: v8:7522, v8:8015
Change-Id: I388352ad931a49102cb5afe350314337a505a150
Reviewed-on: https://chromium-review.googlesource.com/1249106
Reviewed-by: Adam Klein <adamk@chromium.org>
Commit-Queue: Benedikt Meurer <bmeurer@chromium.org>
Cr-Commit-Position: refs/heads/master@{#56276}
This commit is contained in:
Benedikt Meurer 2018-09-27 20:20:07 +02:00 committed by Commit Bot
parent d2e0166ded
commit bd68cc8234
4 changed files with 80 additions and 78 deletions

View File

@ -194,48 +194,49 @@ class AstBigInt {
};
// For generating constants.
#define AST_STRING_CONSTANTS(F) \
F(anonymous_function, "(anonymous function)") \
F(arguments, "arguments") \
F(async, "async") \
F(await, "await") \
F(bigint, "bigint") \
F(boolean, "boolean") \
F(constructor, "constructor") \
F(default, "default") \
F(done, "done") \
F(dot, ".") \
F(dot_for, ".for") \
F(dot_generator_object, ".generator_object") \
F(dot_iterator, ".iterator") \
F(dot_result, ".result") \
F(dot_switch_tag, ".switch_tag") \
F(dot_catch, ".catch") \
F(empty, "") \
F(eval, "eval") \
F(function, "function") \
F(get_space, "get ") \
F(length, "length") \
F(let, "let") \
F(name, "name") \
F(native, "native") \
F(new_target, ".new.target") \
F(next, "next") \
F(number, "number") \
F(object, "object") \
F(proto, "__proto__") \
F(prototype, "prototype") \
F(return, "return") \
F(set_space, "set ") \
F(star_default_star, "*default*") \
F(string, "string") \
F(symbol, "symbol") \
F(this, "this") \
F(this_function, ".this_function") \
F(throw, "throw") \
F(undefined, "undefined") \
F(use_asm, "use asm") \
F(use_strict, "use strict") \
#define AST_STRING_CONSTANTS(F) \
F(anonymous_function, "(anonymous function)") \
F(arguments, "arguments") \
F(async, "async") \
F(await, "await") \
F(bigint, "bigint") \
F(boolean, "boolean") \
F(constructor, "constructor") \
F(default, "default") \
F(done, "done") \
F(dot, ".") \
F(dot_for, ".for") \
F(dot_generator_object, ".generator_object") \
F(dot_iterator, ".iterator") \
F(dot_promise, ".promise") \
F(dot_result, ".result") \
F(dot_switch_tag, ".switch_tag") \
F(dot_catch, ".catch") \
F(empty, "") \
F(eval, "eval") \
F(function, "function") \
F(get_space, "get ") \
F(length, "length") \
F(let, "let") \
F(name, "name") \
F(native, "native") \
F(new_target, ".new.target") \
F(next, "next") \
F(number, "number") \
F(object, "object") \
F(proto, "__proto__") \
F(prototype, "prototype") \
F(return, "return") \
F(set_space, "set ") \
F(star_default_star, "*default*") \
F(string, "string") \
F(symbol, "symbol") \
F(this, "this") \
F(this_function, ".this_function") \
F(throw, "throw") \
F(undefined, "undefined") \
F(use_asm, "use asm") \
F(use_strict, "use strict") \
F(value, "value")
class AstStringConstants final {

View File

@ -69,6 +69,7 @@
V(_, dot_for_string, ".for") \
V(_, dot_generator_object_string, ".generator_object") \
V(_, dot_iterator_string, ".iterator") \
V(_, dot_promise_string, ".promise") \
V(_, dot_result_string, ".result") \
V(_, dot_string, ".") \
V(_, dot_switch_tag_string, ".switch_tag") \

View File

@ -2955,7 +2955,7 @@ Variable* Parser::PromiseVariable() {
Variable* promise = function_state_->scope()->promise_var();
if (promise == nullptr) {
promise = function_state_->scope()->DeclarePromiseVar(
ast_value_factory()->empty_string());
ast_value_factory()->dot_promise_string());
}
return promise;
}

View File

@ -288,41 +288,41 @@ KNOWN_MAPS = {
("RO_SPACE", 0x04711): (171, "Tuple2Map"),
("RO_SPACE", 0x047b1): (173, "ArrayBoilerplateDescriptionMap"),
("RO_SPACE", 0x04aa1): (161, "InterceptorInfoMap"),
("RO_SPACE", 0x06d11): (153, "AccessCheckInfoMap"),
("RO_SPACE", 0x06d61): (154, "AccessorInfoMap"),
("RO_SPACE", 0x06db1): (155, "AccessorPairMap"),
("RO_SPACE", 0x06e01): (156, "AliasedArgumentsEntryMap"),
("RO_SPACE", 0x06e51): (157, "AllocationMementoMap"),
("RO_SPACE", 0x06ea1): (158, "AsyncGeneratorRequestMap"),
("RO_SPACE", 0x06ef1): (159, "DebugInfoMap"),
("RO_SPACE", 0x06f41): (160, "FunctionTemplateInfoMap"),
("RO_SPACE", 0x06f91): (162, "InterpreterDataMap"),
("RO_SPACE", 0x06fe1): (163, "ModuleInfoEntryMap"),
("RO_SPACE", 0x07031): (164, "ModuleMap"),
("RO_SPACE", 0x07081): (165, "ObjectTemplateInfoMap"),
("RO_SPACE", 0x070d1): (166, "PromiseCapabilityMap"),
("RO_SPACE", 0x07121): (167, "PromiseReactionMap"),
("RO_SPACE", 0x07171): (168, "PrototypeInfoMap"),
("RO_SPACE", 0x071c1): (169, "ScriptMap"),
("RO_SPACE", 0x07211): (170, "StackFrameInfoMap"),
("RO_SPACE", 0x07261): (172, "Tuple3Map"),
("RO_SPACE", 0x072b1): (174, "WasmDebugInfoMap"),
("RO_SPACE", 0x07301): (175, "WasmExportedFunctionDataMap"),
("RO_SPACE", 0x07351): (176, "CallableTaskMap"),
("RO_SPACE", 0x073a1): (177, "CallbackTaskMap"),
("RO_SPACE", 0x073f1): (178, "PromiseFulfillReactionJobTaskMap"),
("RO_SPACE", 0x07441): (179, "PromiseRejectReactionJobTaskMap"),
("RO_SPACE", 0x07491): (180, "PromiseResolveThenableJobTaskMap"),
("RO_SPACE", 0x074e1): (181, "MicrotaskQueueMap"),
("RO_SPACE", 0x07531): (182, "AllocationSiteWithWeakNextMap"),
("RO_SPACE", 0x07581): (182, "AllocationSiteWithoutWeakNextMap"),
("RO_SPACE", 0x075d1): (213, "LoadHandler1Map"),
("RO_SPACE", 0x07621): (213, "LoadHandler2Map"),
("RO_SPACE", 0x07671): (213, "LoadHandler3Map"),
("RO_SPACE", 0x076c1): (220, "StoreHandler0Map"),
("RO_SPACE", 0x07711): (220, "StoreHandler1Map"),
("RO_SPACE", 0x07761): (220, "StoreHandler2Map"),
("RO_SPACE", 0x077b1): (220, "StoreHandler3Map"),
("RO_SPACE", 0x06d29): (153, "AccessCheckInfoMap"),
("RO_SPACE", 0x06d79): (154, "AccessorInfoMap"),
("RO_SPACE", 0x06dc9): (155, "AccessorPairMap"),
("RO_SPACE", 0x06e19): (156, "AliasedArgumentsEntryMap"),
("RO_SPACE", 0x06e69): (157, "AllocationMementoMap"),
("RO_SPACE", 0x06eb9): (158, "AsyncGeneratorRequestMap"),
("RO_SPACE", 0x06f09): (159, "DebugInfoMap"),
("RO_SPACE", 0x06f59): (160, "FunctionTemplateInfoMap"),
("RO_SPACE", 0x06fa9): (162, "InterpreterDataMap"),
("RO_SPACE", 0x06ff9): (163, "ModuleInfoEntryMap"),
("RO_SPACE", 0x07049): (164, "ModuleMap"),
("RO_SPACE", 0x07099): (165, "ObjectTemplateInfoMap"),
("RO_SPACE", 0x070e9): (166, "PromiseCapabilityMap"),
("RO_SPACE", 0x07139): (167, "PromiseReactionMap"),
("RO_SPACE", 0x07189): (168, "PrototypeInfoMap"),
("RO_SPACE", 0x071d9): (169, "ScriptMap"),
("RO_SPACE", 0x07229): (170, "StackFrameInfoMap"),
("RO_SPACE", 0x07279): (172, "Tuple3Map"),
("RO_SPACE", 0x072c9): (174, "WasmDebugInfoMap"),
("RO_SPACE", 0x07319): (175, "WasmExportedFunctionDataMap"),
("RO_SPACE", 0x07369): (176, "CallableTaskMap"),
("RO_SPACE", 0x073b9): (177, "CallbackTaskMap"),
("RO_SPACE", 0x07409): (178, "PromiseFulfillReactionJobTaskMap"),
("RO_SPACE", 0x07459): (179, "PromiseRejectReactionJobTaskMap"),
("RO_SPACE", 0x074a9): (180, "PromiseResolveThenableJobTaskMap"),
("RO_SPACE", 0x074f9): (181, "MicrotaskQueueMap"),
("RO_SPACE", 0x07549): (182, "AllocationSiteWithWeakNextMap"),
("RO_SPACE", 0x07599): (182, "AllocationSiteWithoutWeakNextMap"),
("RO_SPACE", 0x075e9): (213, "LoadHandler1Map"),
("RO_SPACE", 0x07639): (213, "LoadHandler2Map"),
("RO_SPACE", 0x07689): (213, "LoadHandler3Map"),
("RO_SPACE", 0x076d9): (220, "StoreHandler0Map"),
("RO_SPACE", 0x07729): (220, "StoreHandler1Map"),
("RO_SPACE", 0x07779): (220, "StoreHandler2Map"),
("RO_SPACE", 0x077c9): (220, "StoreHandler3Map"),
("MAP_SPACE", 0x02201): (1057, "ExternalMap"),
("MAP_SPACE", 0x02251): (1072, "JSMessageObjectMap"),
}