Revision: 20842
Author: [email protected]
Date: Thu Apr 17 11:57:32 2014 UTC
Log: Always pass in code to NewFunctionWithoutPrototype
BUG=
[email protected]
Review URL: https://codereview.chromium.org/239053007
http://code.google.com/p/v8/source/detail?r=20842
Modified:
/branches/bleeding_edge/src/bootstrapper.cc
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/factory.h
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Thu Apr 17 08:33:18 2014 UTC
+++ /branches/bleeding_edge/src/bootstrapper.cc Thu Apr 17 11:57:32 2014 UTC
@@ -484,15 +484,11 @@
// 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 @@
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();
=======================================
--- /branches/bleeding_edge/src/factory.cc Thu Apr 17 11:50:22 2014 UTC
+++ /branches/bleeding_edge/src/factory.cc Thu Apr 17 11:57:32 2014 UTC
@@ -1302,17 +1302,6 @@
JSFunction::SetPrototype(function, prototype);
return function;
}
-
-
-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) {
@@ -2025,13 +2014,12 @@
}
-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>());
}
=======================================
--- /branches/bleeding_edge/src/factory.h Thu Apr 17 11:50:22 2014 UTC
+++ /branches/bleeding_edge/src/factory.h Thu Apr 17 11:57:32 2014 UTC
@@ -441,9 +441,6 @@
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);
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.