Revision: 7173
Author: [email protected]
Date: Tue Mar 15 04:01:21 2011
Log: Revert "Strict mode ThrowTypeError functions for"
[email protected]
Review URL: http://codereview.chromium.org/6696018
http://code.google.com/p/v8/source/detail?r=7173
Modified:
/branches/bleeding_edge/src/arm/codegen-arm.cc
/branches/bleeding_edge/src/arm/full-codegen-arm.cc
/branches/bleeding_edge/src/arm/lithium-codegen-arm.cc
/branches/bleeding_edge/src/bootstrapper.cc
/branches/bleeding_edge/src/builtins.cc
/branches/bleeding_edge/src/builtins.h
/branches/bleeding_edge/src/contexts.h
/branches/bleeding_edge/src/factory.cc
/branches/bleeding_edge/src/factory.h
/branches/bleeding_edge/src/handles.cc
/branches/bleeding_edge/src/handles.h
/branches/bleeding_edge/src/ia32/codegen-ia32.cc
/branches/bleeding_edge/src/ia32/full-codegen-ia32.cc
/branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc
/branches/bleeding_edge/src/messages.js
/branches/bleeding_edge/src/objects.cc
/branches/bleeding_edge/src/runtime.cc
/branches/bleeding_edge/src/x64/codegen-x64.cc
/branches/bleeding_edge/src/x64/full-codegen-x64.cc
/branches/bleeding_edge/src/x64/lithium-codegen-x64.cc
/branches/bleeding_edge/test/mjsunit/strict-mode.js
=======================================
--- /branches/bleeding_edge/src/arm/codegen-arm.cc Tue Mar 15 03:03:57 2011
+++ /branches/bleeding_edge/src/arm/codegen-arm.cc Tue Mar 15 04:01:21 2011
@@ -3112,10 +3112,9 @@
bool pretenure) {
// Use the fast case closure allocation code that allocates in new
// space for nested functions that don't need literals cloning.
- if (!pretenure &&
- scope()->is_function_scope() &&
+ if (scope()->is_function_scope() &&
function_info->num_literals() == 0 &&
- !function_info->strict_mode()) { // Strict mode functions use slow
path.
+ !pretenure) {
FastNewClosureStub stub;
frame_->EmitPush(Operand(function_info));
frame_->SpillAll();
=======================================
--- /branches/bleeding_edge/src/arm/full-codegen-arm.cc Tue Mar 15 03:03:57
2011
+++ /branches/bleeding_edge/src/arm/full-codegen-arm.cc Tue Mar 15 04:01:21
2011
@@ -1084,10 +1084,9 @@
// doesn't just get a copy of the existing unoptimized code.
if (!FLAG_always_opt &&
!FLAG_prepare_always_opt &&
- !pretenure &&
scope()->is_function_scope() &&
info->num_literals() == 0 &&
- !info->strict_mode()) { // Strict mode functions use slow path.
+ !pretenure) {
FastNewClosureStub stub;
__ mov(r0, Operand(info));
__ push(r0);
=======================================
--- /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Mon Mar 14
10:46:37 2011
+++ /branches/bleeding_edge/src/arm/lithium-codegen-arm.cc Tue Mar 15
04:01:21 2011
@@ -3717,8 +3717,7 @@
// space for nested functions that don't need literals cloning.
Handle<SharedFunctionInfo> shared_info = instr->shared_info();
bool pretenure = instr->hydrogen()->pretenure();
- if (!pretenure && shared_info->num_literals() == 0 &&
- !shared_info->strict_mode()) { // Strict mode functions use slow
path.
+ if (shared_info->num_literals() == 0 && !pretenure) {
FastNewClosureStub stub;
__ mov(r1, Operand(shared_info));
__ push(r1);
=======================================
--- /branches/bleeding_edge/src/bootstrapper.cc Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/bootstrapper.cc Tue Mar 15 04:01:21 2011
@@ -207,10 +207,6 @@
void CreateRoots();
// Creates the empty function. Used for creating a context from scratch.
Handle<JSFunction> CreateEmptyFunction();
- void CreateThrowTypeErrorCallbacks(
- Handle<FixedArray> callbacks,
- Builtins::Name builtin);
- void CreateThrowTypeError(Handle<JSFunction> empty);
// Creates the global objects using the global and the template passed in
// through the API. We call this regardless of whether we are building a
// context from scratch or using a deserialized one from the partial
snapshot
@@ -267,10 +263,6 @@
Handle<DescriptorArray> ComputeFunctionInstanceDescriptor(
PrototypePropertyMode prototypeMode);
void MakeFunctionInstancePrototypeWritable();
- Handle<DescriptorArray> ComputeStrictFunctionDescriptor(
- PrototypePropertyMode propertyMode,
- Handle<FixedArray> arguments,
- Handle<FixedArray> caller);
static bool CompileBuiltin(int index);
static bool CompileNative(Vector<const char> name, Handle<String>
source);
@@ -505,113 +497,6 @@
empty_function->set_map(*empty_fm);
return empty_function;
}
-
-
-Handle<DescriptorArray> Genesis::ComputeStrictFunctionDescriptor(
- PrototypePropertyMode prototypeMode,
- Handle<FixedArray> arguments,
- Handle<FixedArray> caller) {
- Handle<DescriptorArray> descriptors =
- Factory::NewDescriptorArray(prototypeMode == DONT_ADD_PROTOTYPE ?
4 : 5);
- PropertyAttributes attributes = static_cast<PropertyAttributes>(
- DONT_ENUM | DONT_DELETE | READ_ONLY);
-
- { // length
- Handle<Proxy> proxy = Factory::NewProxy(&Accessors::FunctionLength);
- CallbacksDescriptor d(*Factory::length_symbol(), *proxy, attributes);
- descriptors->Set(0, &d);
- }
- { // name
- Handle<Proxy> proxy = Factory::NewProxy(&Accessors::FunctionName);
- CallbacksDescriptor d(*Factory::name_symbol(), *proxy, attributes);
- descriptors->Set(1, &d);
- }
- { // arguments
- CallbacksDescriptor d(*Factory::arguments_symbol(), *arguments,
attributes);
- descriptors->Set(2, &d);
- }
- { // caller
- CallbacksDescriptor d(*Factory::caller_symbol(), *caller, attributes);
- descriptors->Set(3, &d);
- }
-
- // prototype
- if (prototypeMode != DONT_ADD_PROTOTYPE) {
- if (prototypeMode == ADD_WRITEABLE_PROTOTYPE) {
- attributes = static_cast<PropertyAttributes>(attributes &
~READ_ONLY);
- }
- CallbacksDescriptor d(
- *Factory::prototype_symbol(),
- *Factory::NewProxy(&Accessors::FunctionPrototype),
- attributes);
- descriptors->Set(4, &d);
- }
-
- descriptors->Sort();
- return descriptors;
-}
-
-
-void Genesis::CreateThrowTypeErrorCallbacks(
- Handle<FixedArray> callbacks,
- Builtins::Name builtin) {
- // Create the ThrowTypeError function.
- Handle<String> name = Factory::LookupAsciiSymbol("ThrowTypeError");
- Handle<JSFunction> pill =
Factory::NewFunctionWithoutPrototypeStrict(name);
- Handle<Code> code = Handle<Code>(Builtins::builtin(builtin));
- pill->set_map(global_context()->function_map_strict());
- pill->set_code(*code);
- pill->shared()->set_code(*code);
- pill->shared()->DontAdaptArguments();
-
- // Install the poison pills into the calbacks array.
- callbacks->set(0, *pill);
- callbacks->set(1, *pill);
-
- PreventExtensions(pill);
-}
-
-
-// ECMAScript 5th Edition, 13.2.3
-void Genesis::CreateThrowTypeError(Handle<JSFunction> empty) {
- // Create the pill callbacks arrays. The get/set callacks are installed
- // after the maps get created below.
- Handle<FixedArray> arguments = Factory::NewFixedArray(2, TENURED);
- Handle<FixedArray> caller = Factory::NewFixedArray(2, TENURED);
-
- { // Allocate map for the strict mode function instances.
- Handle<Map> map = Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
- global_context()->set_function_instance_map_strict(*map);
- Handle<DescriptorArray> descriptors = ComputeStrictFunctionDescriptor(
- ADD_WRITEABLE_PROTOTYPE, arguments, caller);
- map->set_instance_descriptors(*descriptors);
- map->set_function_with_prototype(true);
- map->set_prototype(*empty);
- }
-
- { // Allocate map for the prototype-less strict mode instances.
- Handle<Map> map = Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
- global_context()->set_function_without_prototype_map_strict(*map);
- Handle<DescriptorArray> descriptors = ComputeStrictFunctionDescriptor(
- DONT_ADD_PROTOTYPE, arguments, caller);
- map->set_instance_descriptors(*descriptors);
- map->set_function_with_prototype(false);
- map->set_prototype(*empty);
- }
-
- { // Allocate map for the strict mode functions.
- Handle<Map> map = Factory::NewMap(JS_FUNCTION_TYPE, JSFunction::kSize);
- global_context()->set_function_map_strict(*map);
- Handle<DescriptorArray> descriptors = ComputeStrictFunctionDescriptor(
- ADD_READONLY_PROTOTYPE, arguments, caller);
- map->set_instance_descriptors(*descriptors);
- map->set_function_with_prototype(true);
- map->set_prototype(*empty);
- }
-
- CreateThrowTypeErrorCallbacks(arguments,
Builtins::StrictFunctionArguments);
- CreateThrowTypeErrorCallbacks(caller, Builtins::StrictFunctionCaller);
-}
static void AddToWeakGlobalContextList(Context* context) {
@@ -1973,7 +1858,6 @@
// We get here if there was no context snapshot.
CreateRoots();
Handle<JSFunction> empty_function = CreateEmptyFunction();
- CreateThrowTypeError(empty_function);
Handle<GlobalObject> inner_global;
Handle<JSGlobalProxy> global_proxy =
CreateNewGlobals(global_template, global_object, &inner_global);
=======================================
--- /branches/bleeding_edge/src/builtins.cc Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/builtins.cc Tue Mar 15 04:01:21 2011
@@ -956,24 +956,6 @@
return result_array;
}
-
-
-//
-----------------------------------------------------------------------------
-// Strict mode poison pills
-
-
-BUILTIN(StrictFunctionCaller) {
- HandleScope scope;
- return Top::Throw(*Factory::NewTypeError("strict_function_caller",
- HandleVector<Object>(NULL,
0)));
-}
-
-
-BUILTIN(StrictFunctionArguments) {
- HandleScope scope;
- return Top::Throw(*Factory::NewTypeError("strict_function_arguments",
- HandleVector<Object>(NULL,
0)));
-}
//
-----------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/builtins.h Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/builtins.h Tue Mar 15 04:01:21 2011
@@ -58,10 +58,7 @@
V(FastHandleApiCall, NO_EXTRA_ARGUMENTS) \
V(HandleApiCallConstruct, NEEDS_CALLED_FUNCTION) \
V(HandleApiCallAsFunction, NO_EXTRA_ARGUMENTS) \
- V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS) \
- \
- V(StrictFunctionCaller, NO_EXTRA_ARGUMENTS) \
- V(StrictFunctionArguments, NO_EXTRA_ARGUMENTS)
+ V(HandleApiCallAsConstructor, NO_EXTRA_ARGUMENTS)
// Define list of builtins implemented in assembly.
=======================================
--- /branches/bleeding_edge/src/contexts.h Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/contexts.h Tue Mar 15 04:01:21 2011
@@ -78,12 +78,8 @@
V(INSTANTIATE_FUN_INDEX, JSFunction, instantiate_fun) \
V(CONFIGURE_INSTANCE_FUN_INDEX, JSFunction, configure_instance_fun) \
V(FUNCTION_MAP_INDEX, Map, function_map) \
- V(FUNCTION_MAP_INDEX_STRICT, Map, function_map_strict) \
V(FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map,
function_without_prototype_map) \
- V(FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX_STRICT, Map, \
- function_without_prototype_map_strict) \
V(FUNCTION_INSTANCE_MAP_INDEX, Map, function_instance_map) \
- V(FUNCTION_INSTANCE_MAP_INDEX_STRICT, Map, function_instance_map_strict)
\
V(JS_ARRAY_MAP_INDEX, Map, js_array_map)\
V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map)\
V(ARGUMENTS_BOILERPLATE_INDEX, JSObject, arguments_boilerplate) \
@@ -189,11 +185,8 @@
JS_ARRAY_MAP_INDEX,
REGEXP_RESULT_MAP_INDEX,
FUNCTION_MAP_INDEX,
- FUNCTION_MAP_INDEX_STRICT,
FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX,
- FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX_STRICT,
FUNCTION_INSTANCE_MAP_INDEX,
- FUNCTION_INSTANCE_MAP_INDEX_STRICT,
INITIAL_OBJECT_PROTOTYPE_INDEX,
BOOLEAN_FUNCTION_INDEX,
NUMBER_FUNCTION_INDEX,
=======================================
--- /branches/bleeding_edge/src/factory.cc Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/factory.cc Tue Mar 15 04:01:21 2011
@@ -351,12 +351,7 @@
Handle<Context> context,
PretenureFlag pretenure) {
Handle<JSFunction> result = BaseNewFunctionFromSharedFunctionInfo(
- function_info,
- function_info->strict_mode()
- ? Top::function_map_strict()
- : Top::function_map(),
- pretenure);
-
+ function_info, Top::function_map(), pretenure);
result->set_context(*context);
int number_of_literals = function_info->num_literals();
Handle<FixedArray> literals =
@@ -830,24 +825,6 @@
return fun;
}
-
-Handle<JSFunction> Factory::NewFunctionWithoutPrototypeStrictHelper(
- Handle<String> name) {
- Handle<SharedFunctionInfo> function_share = NewSharedFunctionInfo(name);
- CALL_HEAP_FUNCTION(Heap::AllocateFunction(
- *Top::function_without_prototype_map_strict(),
- *function_share,
- *the_hole_value()),
- JSFunction);
-}
-
-
-Handle<JSFunction> Factory::NewFunctionWithoutPrototypeStrict(
- Handle<String> name) {
- Handle<JSFunction> fun = NewFunctionWithoutPrototypeStrictHelper(name);
- fun->set_context(Top::context()->global_context());
- return fun;
-}
Handle<Object> Factory::ToObject(Handle<Object> object) {
CALL_HEAP_FUNCTION(object->ToObject(), Object);
=======================================
--- /branches/bleeding_edge/src/factory.h Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/factory.h Tue Mar 15 04:01:21 2011
@@ -232,8 +232,6 @@
Handle<Object> prototype);
static Handle<JSFunction> NewFunctionWithoutPrototype(Handle<String>
name);
- static Handle<JSFunction> NewFunctionWithoutPrototypeStrict(
- Handle<String> name);
static Handle<JSFunction> NewFunction(Handle<Object> super, bool
is_global);
@@ -410,8 +408,6 @@
static Handle<JSFunction> NewFunctionWithoutPrototypeHelper(
Handle<String> name);
- static Handle<JSFunction> NewFunctionWithoutPrototypeStrictHelper(
- Handle<String> name);
static Handle<DescriptorArray> CopyAppendCallbackDescriptors(
Handle<DescriptorArray> array,
=======================================
--- /branches/bleeding_edge/src/handles.cc Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/handles.cc Tue Mar 15 04:01:21 2011
@@ -360,11 +360,6 @@
const bool skip_hidden_prototypes = false;
CALL_HEAP_FUNCTION(obj->SetPrototype(*value, skip_hidden_prototypes),
Object);
}
-
-
-Handle<Object> PreventExtensions(Handle<JSObject> object) {
- CALL_HEAP_FUNCTION(object->PreventExtensions(), Object);
-}
Handle<Object> GetHiddenProperties(Handle<JSObject> obj,
=======================================
--- /branches/bleeding_edge/src/handles.h Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/handles.h Tue Mar 15 04:01:21 2011
@@ -370,7 +370,6 @@
Handle<Object> SetPrototype(Handle<JSFunction> function,
Handle<Object> prototype);
-Handle<Object> PreventExtensions(Handle<JSObject> object);
// Does lazy compilation of the given function. Returns true on success and
// false if the compilation resulted in a stack overflow.
=======================================
--- /branches/bleeding_edge/src/ia32/codegen-ia32.cc Tue Mar 15 03:03:57
2011
+++ /branches/bleeding_edge/src/ia32/codegen-ia32.cc Tue Mar 15 04:01:21
2011
@@ -4916,10 +4916,9 @@
// Use the fast case closure allocation code that allocates in new
// space for nested functions that don't need literals cloning.
- if (!pretenure &&
- scope()->is_function_scope() &&
+ if (scope()->is_function_scope() &&
function_info->num_literals() == 0 &&
- !function_info->strict_mode()) { // Strict mode functions use slow
path.
+ !pretenure) {
FastNewClosureStub stub;
frame()->EmitPush(Immediate(function_info));
return frame()->CallStub(&stub, 1);
=======================================
--- /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Mar 15
03:03:57 2011
+++ /branches/bleeding_edge/src/ia32/full-codegen-ia32.cc Tue Mar 15
04:01:21 2011
@@ -1017,10 +1017,9 @@
// doesn't just get a copy of the existing unoptimized code.
if (!FLAG_always_opt &&
!FLAG_prepare_always_opt &&
- !pretenure &&
scope()->is_function_scope() &&
info->num_literals() == 0 &&
- !info->strict_mode()) { // Strict mode functions go through slow
path.
+ !pretenure) {
FastNewClosureStub stub;
__ push(Immediate(info));
__ CallStub(&stub);
=======================================
--- /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Mon Mar 14
10:46:37 2011
+++ /branches/bleeding_edge/src/ia32/lithium-codegen-ia32.cc Tue Mar 15
04:01:21 2011
@@ -3693,8 +3693,7 @@
// space for nested functions that don't need literals cloning.
Handle<SharedFunctionInfo> shared_info = instr->shared_info();
bool pretenure = instr->hydrogen()->pretenure();
- if (!pretenure && shared_info->num_literals() == 0 &&
- !shared_info->strict_mode()) {
+ if (shared_info->num_literals() == 0 && !pretenure) {
FastNewClosureStub stub;
__ push(Immediate(shared_info));
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr, false);
=======================================
--- /branches/bleeding_edge/src/messages.js Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/messages.js Tue Mar 15 04:01:21 2011
@@ -230,8 +230,6 @@
strict_function: ["In strict mode code, functions can
only be declared at top level or immediately within another function." ],
strict_read_only_property: ["Cannot assign to read only
property '", "%0", "' of ", "%1"],
strict_cannot_assign: ["Cannot assign to read
only '", "%0", "' in strict mode"],
- strict_function_caller: ["Cannot access property 'caller' of a
strict mode function"],
- strict_function_arguments: ["Cannot access property 'arguments'
of a strict mode function"],
};
}
var message_type = %MessageGetType(message);
=======================================
--- /branches/bleeding_edge/src/objects.cc Mon Mar 14 10:46:37 2011
+++ /branches/bleeding_edge/src/objects.cc Tue Mar 15 04:01:21 2011
@@ -5536,21 +5536,12 @@
Object* JSFunction::RemovePrototype() {
- Map* no_prototype_map = shared()->strict_mode()
- ?
context()->global_context()->function_without_prototype_map_strict()
- : context()->global_context()->function_without_prototype_map();
-
- if (map() == no_prototype_map) {
+ if (map() ==
context()->global_context()->function_without_prototype_map()) {
// Be idempotent.
return this;
}
-
- ASSERT(!shared()->strict_mode() ||
- map() == context()->global_context()->function_map_strict());
- ASSERT(shared()->strict_mode() ||
- map() == context()->global_context()->function_map());
-
- set_map(no_prototype_map);
+ ASSERT(map() == context()->global_context()->function_map());
+ set_map(context()->global_context()->function_without_prototype_map());
set_prototype_or_initial_map(Heap::the_hole_value());
return this;
}
=======================================
--- /branches/bleeding_edge/src/runtime.cc Tue Mar 15 02:16:12 2011
+++ /branches/bleeding_edge/src/runtime.cc Tue Mar 15 04:01:21 2011
@@ -8045,14 +8045,11 @@
HandleScope scope;
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSFunction, func, 0);
-
- Handle<Map> map = func->shared()->strict_mode()
- ? Top::function_instance_map_strict()
- : Top::function_instance_map();
-
- ASSERT(func->map()->instance_type() == map->instance_type());
- ASSERT(func->map()->instance_size() == map->instance_size());
- func->set_map(*map);
+ ASSERT(func->map()->instance_type() ==
+ Top::function_instance_map()->instance_type());
+ ASSERT(func->map()->instance_size() ==
+ Top::function_instance_map()->instance_size());
+ func->set_map(*Top::function_instance_map());
return *func;
}
=======================================
--- /branches/bleeding_edge/src/x64/codegen-x64.cc Tue Mar 15 03:03:57 2011
+++ /branches/bleeding_edge/src/x64/codegen-x64.cc Tue Mar 15 04:01:21 2011
@@ -4260,10 +4260,9 @@
// Use the fast case closure allocation code that allocates in new
// space for nested functions that don't need literals cloning.
- if (!pretenure &&
- scope()->is_function_scope() &&
+ if (scope()->is_function_scope() &&
function_info->num_literals() == 0 &&
- !function_info->strict_mode()) { // Strict mode functions use slow
path.
+ !pretenure) {
FastNewClosureStub stub;
frame_->Push(function_info);
Result answer = frame_->CallStub(&stub, 1);
=======================================
--- /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Mar 15 03:03:57
2011
+++ /branches/bleeding_edge/src/x64/full-codegen-x64.cc Tue Mar 15 04:01:21
2011
@@ -1039,10 +1039,9 @@
// doesn't just get a copy of the existing unoptimized code.
if (!FLAG_always_opt &&
!FLAG_prepare_always_opt &&
- !pretenure &&
scope()->is_function_scope() &&
info->num_literals() == 0 &&
- !info->strict_mode()) { // Strict mode functions use slow path.
+ !pretenure) {
FastNewClosureStub stub;
__ Push(info);
__ CallStub(&stub);
=======================================
--- /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Mar 15
03:03:57 2011
+++ /branches/bleeding_edge/src/x64/lithium-codegen-x64.cc Tue Mar 15
04:01:21 2011
@@ -3496,8 +3496,7 @@
// space for nested functions that don't need literals cloning.
Handle<SharedFunctionInfo> shared_info = instr->shared_info();
bool pretenure = instr->hydrogen()->pretenure();
- if (!pretenure && shared_info->num_literals() == 0 &&
- !shared_info->strict_mode()) {
+ if (shared_info->num_literals() == 0 && !pretenure) {
FastNewClosureStub stub;
__ Push(shared_info);
CallCode(stub.GetCode(), RelocInfo::CODE_TARGET, instr);
=======================================
--- /branches/bleeding_edge/test/mjsunit/strict-mode.js Mon Mar 14 10:46:37
2011
+++ /branches/bleeding_edge/test/mjsunit/strict-mode.js Tue Mar 15 04:01:21
2011
@@ -976,47 +976,3 @@
assertEquals(["c", "d", "a", "b"], strict("a", "b"));
assertEquals(["c", "d", "c", "d"], nonstrict("a", "b"));
})();
-
-
-(function TestStrictFunctionPills() {
- function strict() {
- "use strict";
- }
- assertThrows(function() { strict.caller; }, TypeError);
- assertThrows(function() { strict.arguments; }, TypeError);
-
- var another = new Function("'use strict'");
- assertThrows(function() { another.caller; }, TypeError);
- assertThrows(function() { another.arguments; }, TypeError);
-
- var third = (function() { "use strict"; return function() {}; })();
- assertThrows(function() { third.caller; }, TypeError);
- assertThrows(function() { third.arguments; }, TypeError);
-
- function CheckPill(pill) {
- assertEquals("function", typeof pill);
- assertInstanceof(pill, Function);
- assertThrows(function() { pill.property = "value"; }, TypeError);
- assertThrows(pill, TypeError);
- assertEquals(pill.prototype, (function(){}).prototype);
- var d = Object.getOwnPropertyDescriptor(pill, "prototype");
- assertFalse(d.writable);
- assertFalse(d.configurable);
- assertFalse(d.enumerable);
- }
-
- function CheckPillDescriptor(func, name) {
- var descriptor = Object.getOwnPropertyDescriptor(func, name);
- CheckPill(descriptor.get)
- CheckPill(descriptor.set);
- assertFalse(descriptor.enumerable);
- assertFalse(descriptor.configurable);
- }
-
- CheckPillDescriptor(strict, "caller");
- CheckPillDescriptor(strict, "arguments");
- CheckPillDescriptor(another, "caller");
- CheckPillDescriptor(another, "arguments");
- CheckPillDescriptor(third, "caller");
- CheckPillDescriptor(third, "arguments");
-})();
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev