Always pass in code to NewFunctionWithoutPrototype

BUG=
R=ishell@chromium.org

Review URL: https://codereview.chromium.org/239053007

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20842 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
verwaest@chromium.org 2014-04-17 11:57:32 +00:00
parent 1c314382c0
commit 49b19ecd20
3 changed files with 8 additions and 29 deletions

View File

@ -484,15 +484,11 @@ Handle<JSFunction> Genesis::CreateEmptyFunction(Isolate* isolate) {
// 262 15.3.4.
Handle<String> empty_string =
factory->InternalizeOneByteString(STATIC_ASCII_VECTOR("Empty"));
Handle<Code> code(isolate->builtins()->builtin(Builtins::kEmptyFunction));
Handle<JSFunction> empty_function =
factory->NewFunctionWithoutPrototype(empty_string, SLOPPY);
factory->NewFunctionWithoutPrototype(empty_string, code);
// --- E m p t y ---
Handle<Code> code =
Handle<Code>(isolate->builtins()->builtin(
Builtins::kEmptyFunction));
empty_function->set_code(*code);
empty_function->shared()->set_code(*code);
Handle<String> source =
factory->NewStringFromOneByte(STATIC_ASCII_VECTOR("() {}"));
Handle<Script> script = factory->NewScript(source);
@ -567,13 +563,11 @@ Handle<JSFunction> Genesis::GetThrowTypeErrorFunction() {
if (throw_type_error_function.is_null()) {
Handle<String> name = factory()->InternalizeOneByteString(
STATIC_ASCII_VECTOR("ThrowTypeError"));
throw_type_error_function =
factory()->NewFunctionWithoutPrototype(name, SLOPPY);
Handle<Code> code(isolate()->builtins()->builtin(
Builtins::kStrictModePoisonPill));
throw_type_error_function =
factory()->NewFunctionWithoutPrototype(name, code);
throw_type_error_function->set_map(native_context()->sloppy_function_map());
throw_type_error_function->set_code(*code);
throw_type_error_function->shared()->set_code(*code);
throw_type_error_function->shared()->DontAdaptArguments();
JSObject::PreventExtensions(throw_type_error_function).Assert();

View File

@ -1304,17 +1304,6 @@ Handle<JSFunction> Factory::NewFunctionWithPrototype(Handle<String> name,
}
Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
Handle<Code> code) {
Handle<JSFunction> function = NewFunctionWithoutPrototype(name, SLOPPY);
function->shared()->set_code(*code);
function->set_code(*code);
ASSERT(!function->has_initial_map());
ASSERT(!function->has_prototype());
return function;
}
Handle<ScopeInfo> Factory::NewScopeInfo(int length) {
Handle<FixedArray> array = NewFixedArray(length, TENURED);
array->set_map_no_write_barrier(*scope_info_map());
@ -2025,13 +2014,12 @@ Handle<JSFunction> Factory::NewFunction(Handle<String> name,
}
Handle<JSFunction> Factory::NewFunctionWithoutPrototype(
Handle<String> name,
StrictMode strict_mode) {
Handle<JSFunction> Factory::NewFunctionWithoutPrototype(Handle<String> name,
Handle<Code> code) {
Handle<SharedFunctionInfo> info = NewSharedFunctionInfo(name);
info->set_code(*code);
Handle<Context> context(isolate()->context()->native_context());
Handle<JSFunction> fun = NewFunction(info, context, MaybeHandle<Object>());
return fun;
return NewFunction(info, context, MaybeHandle<Object>());
}

View File

@ -441,9 +441,6 @@ class Factory V8_FINAL {
Handle<Code> code,
bool force_initial_map);
Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name,
StrictMode strict_mode);
Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String> name,
Handle<Code> code);