Commit c5be0b85 authored by Igor Sheludko's avatar Igor Sheludko Committed by Commit Bot

[runtime] Pass LanguageMode instead of bool to Factory::NewFunctionXXX().

Bug: v8:6459
Cq-Include-Trybots: master.tryserver.chromium.linux:linux_chromium_rel_ng
Change-Id: I34d6203c7f26c54423789699e4263ce815171d3f
Reviewed-on: https://chromium-review.googlesource.com/558874Reviewed-by: 's avatarCamillo Bruni <cbruni@chromium.org>
Commit-Queue: Igor Sheludko <ishell@chromium.org>
Cr-Commit-Position: refs/heads/master@{#46380}
parent 07752032
......@@ -9836,7 +9836,7 @@ Local<Function> debug::GetBuiltin(Isolate* v8_isolate, Builtin builtin) {
i::Handle<i::Code> call_code(isolate->builtins()->builtin(name));
i::Handle<i::JSFunction> fun =
isolate->factory()->NewFunctionWithoutPrototype(
isolate->factory()->empty_string(), call_code, false);
isolate->factory()->empty_string(), call_code, i::SLOPPY);
fun->shared()->DontAdaptArguments();
return Utils::ToLocal(handle_scope.CloseAndEscape(fun));
}
......
......@@ -340,8 +340,8 @@ Handle<JSFunction> CreateFunction(Isolate* isolate, Handle<String> name,
Handle<JSFunction> result =
maybe_prototype.ToHandle(&prototype)
? factory->NewFunction(name, call_code, prototype, type,
instance_size, true)
: factory->NewFunctionWithoutPrototype(name, call_code, true);
instance_size, STRICT)
: factory->NewFunctionWithoutPrototype(name, call_code, STRICT);
result->shared()->set_native(true);
return result;
}
......@@ -630,7 +630,7 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorIntrinsic(
factory()->InternalizeOneByteString(STATIC_CHAR_VECTOR("ThrowTypeError"));
Handle<Code> code(isolate()->builtins()->builtin(builtin_name));
Handle<JSFunction> function =
factory()->NewFunctionWithoutPrototype(name, code, true);
factory()->NewFunctionWithoutPrototype(name, code, STRICT);
function->shared()->DontAdaptArguments();
// %ThrowTypeError% must not have a name property.
......
......@@ -84,7 +84,7 @@ void InstallContextFunction(Handle<JSObject> target, const char* name,
Name::ToFunctionName(factory->InternalizeUtf8String(name))
.ToHandleChecked();
Handle<JSFunction> fun =
factory->NewFunctionWithoutPrototype(name_string, call_code, false);
factory->NewFunctionWithoutPrototype(name_string, call_code, SLOPPY);
fun->shared()->set_native(true);
fun->shared()->DontAdaptArguments();
fun->shared()->set_length(1);
......
......@@ -1488,37 +1488,34 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name) {
return result;
}
Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
Handle<Code> code,
bool is_strict) {
Handle<Map> map = is_strict
Handle<JSFunction> Factory::NewFunctionWithoutPrototype(
Handle<String> name, Handle<Code> code, LanguageMode language_mode) {
Handle<Map> map = is_strict(language_mode)
? isolate()->strict_function_without_prototype_map()
: isolate()->sloppy_function_without_prototype_map();
Handle<JSFunction> result = NewFunction(map, name, code);
result->shared()->set_language_mode(is_strict ? STRICT : SLOPPY);
result->shared()->set_language_mode(language_mode);
return result;
}
Handle<JSFunction> Factory::NewFunction(Handle<String> name, Handle<Code> code,
Handle<Object> prototype,
bool is_strict) {
Handle<Map> map = is_strict ? isolate()->strict_function_map()
: isolate()->sloppy_function_map();
LanguageMode language_mode) {
Handle<Map> map = is_strict(language_mode) ? isolate()->strict_function_map()
: isolate()->sloppy_function_map();
Handle<JSFunction> result = NewFunction(map, name, code);
result->set_prototype_or_initial_map(*prototype);
result->shared()->set_language_mode(is_strict ? STRICT : SLOPPY);
result->shared()->set_language_mode(language_mode);
return result;
}
Handle<JSFunction> Factory::NewFunction(Handle<String> name, Handle<Code> code,
Handle<Object> prototype,
InstanceType type, int instance_size,
bool is_strict) {
LanguageMode language_mode) {
// Allocate the function
Handle<JSFunction> function = NewFunction(name, code, prototype, is_strict);
Handle<JSFunction> function =
NewFunction(name, code, prototype, language_mode);
ElementsKind elements_kind =
type == JS_ARRAY_TYPE ? PACKED_SMI_ELEMENTS : HOLEY_SMI_ELEMENTS;
......
......@@ -600,11 +600,11 @@ class V8_EXPORT_PRIVATE Factory final {
PretenureFlag pretenure = TENURED);
Handle<JSFunction> NewFunction(Handle<String> name, Handle<Code> code,
Handle<Object> prototype,
bool is_strict = false);
LanguageMode language_mode = SLOPPY);
Handle<JSFunction> NewFunction(Handle<String> name);
Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name,
Handle<Code> code,
bool is_strict = false);
Handle<JSFunction> NewFunctionWithoutPrototype(
Handle<String> name, Handle<Code> code,
LanguageMode language_mode = SLOPPY);
Handle<JSFunction> NewFunctionFromSharedFunctionInfo(
Handle<Map> initial_map, Handle<SharedFunctionInfo> function_info,
......@@ -626,7 +626,7 @@ class V8_EXPORT_PRIVATE Factory final {
Handle<JSFunction> NewFunction(Handle<String> name, Handle<Code> code,
Handle<Object> prototype, InstanceType type,
int instance_size,
bool is_strict = false);
LanguageMode language_mode = SLOPPY);
Handle<JSFunction> NewFunction(Handle<String> name,
Handle<Code> code,
InstanceType type,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment