Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(949)

Unified Diff: src/runtime.cc

Issue 177683002: Mode clean-up pt 1: rename classic/non-strict mode to sloppy mode (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« src/preparser.h ('K') | « src/runtime.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 60416f7147a338462df317445b3b5896b153ed65..2787cd2edb30813538f2d2d5da3acc66622b8fb9 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -158,7 +158,7 @@ namespace internal {
#define CONVERT_STRICT_MODE_ARG_CHECKED(name, index) \
RUNTIME_ASSERT(args[index]->IsSmi()); \
RUNTIME_ASSERT(args.smi_at(index) == kStrictMode || \
- args.smi_at(index) == kNonStrictMode); \
+ args.smi_at(index) == kSloppyMode); \
StrictModeFlag name = \
static_cast<StrictModeFlag>(args.smi_at(index));
@@ -167,7 +167,7 @@ namespace internal {
// and store it in a LanguageMode variable with the given name.
#define CONVERT_LANGUAGE_MODE_ARG(name, index) \
ASSERT(args[index]->IsSmi()); \
- ASSERT(args.smi_at(index) == CLASSIC_MODE || \
+ ASSERT(args.smi_at(index) == SLOPPY_MODE || \
args.smi_at(index) == STRICT_MODE || \
args.smi_at(index) == EXTENDED_MODE); \
LanguageMode name = \
@@ -298,7 +298,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
if (Handle<String>::cast(key)->AsArrayIndex(&element_index)) {
// Array index as string (uint32).
result = JSObject::SetOwnElement(
- boilerplate, element_index, value, kNonStrictMode);
+ boilerplate, element_index, value, kSloppyMode);
} else {
Handle<String> name(String::cast(*key));
ASSERT(!name->AsArrayIndex(&element_index));
@@ -309,7 +309,7 @@ static Handle<Object> CreateObjectLiteralBoilerplate(
} else if (key->ToArrayIndex(&element_index)) {
// Array index (uint32).
result = JSObject::SetOwnElement(
- boilerplate, element_index, value, kNonStrictMode);
+ boilerplate, element_index, value, kSloppyMode);
} else {
// Non-uint32 number.
ASSERT(key->IsNumber());
@@ -2120,7 +2120,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareGlobals) {
RETURN_IF_EMPTY_HANDLE(isolate,
JSObject::SetProperty(
global, name, value, static_cast<PropertyAttributes>(attr),
- language_mode == CLASSIC_MODE ? kNonStrictMode : kStrictMode));
+ language_mode == SLOPPY_MODE ? kSloppyMode : kStrictMode));
}
}
@@ -2177,7 +2177,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
RETURN_IF_EMPTY_HANDLE(
isolate,
JSReceiver::SetProperty(object, name, initial_value, mode,
- kNonStrictMode));
+ kSloppyMode));
}
}
@@ -2223,7 +2223,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_DeclareContextSlot) {
JSObject::SetLocalPropertyIgnoreAttributes(object, name, value, mode));
} else {
RETURN_IF_EMPTY_HANDLE(isolate,
- JSReceiver::SetProperty(object, name, value, mode, kNonStrictMode));
+ JSReceiver::SetProperty(object, name, value, mode, kSloppyMode));
}
}
@@ -2245,8 +2245,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
CONVERT_ARG_HANDLE_CHECKED(String, name, 0);
RUNTIME_ASSERT(args[1]->IsSmi());
CONVERT_LANGUAGE_MODE_ARG(language_mode, 1);
- StrictModeFlag strict_mode_flag = (language_mode == CLASSIC_MODE)
- ? kNonStrictMode : kStrictMode;
+ StrictModeFlag strict_mode_flag = (language_mode == SLOPPY_MODE)
+ ? kSloppyMode : kStrictMode;
// According to ECMA-262, section 12.2, page 62, the property must
// not be deletable.
@@ -2334,11 +2334,10 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstGlobal) {
// BUG 1213575: Handle the case where we have to set a read-only
// property through an interceptor and only do it if it's
// uninitialized, e.g. the hole. Nirk...
- // Passing non-strict mode because the property is writable.
+ // Passing sloppy mode because the property is writable.
RETURN_IF_EMPTY_HANDLE(
isolate,
- JSReceiver::SetProperty(global, name, value, attributes,
- kNonStrictMode));
+ JSReceiver::SetProperty(global, name, value, attributes, kSloppyMode));
return *value;
}
@@ -2408,7 +2407,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstContextSlot) {
// Strict mode not needed (const disallowed in strict mode).
RETURN_IF_EMPTY_HANDLE(
isolate,
- JSReceiver::SetProperty(global, name, value, NONE, kNonStrictMode));
+ JSReceiver::SetProperty(global, name, value, NONE, kSloppyMode));
return *value;
}
@@ -2460,7 +2459,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeConstContextSlot) {
RETURN_IF_EMPTY_HANDLE(
isolate,
JSReceiver::SetProperty(object, name, value, attributes,
- kNonStrictMode));
+ kSloppyMode));
}
}
@@ -2643,7 +2642,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SpecialArrayFunctions) {
}
-RUNTIME_FUNCTION(MaybeObject*, Runtime_IsClassicModeFunction) {
+RUNTIME_FUNCTION(MaybeObject*, Runtime_IsSloppyModeFunction) {
SealHandleScope shs(isolate);
ASSERT(args.length() == 1);
CONVERT_ARG_CHECKED(JSReceiver, callable, 0);
@@ -2657,7 +2656,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_IsClassicModeFunction) {
}
JSFunction* function = JSFunction::cast(callable);
SharedFunctionInfo* shared = function->shared();
- return isolate->heap()->ToBoolean(shared->is_classic_mode());
+ return isolate->heap()->ToBoolean(shared->is_sloppy_mode());
}
@@ -2677,7 +2676,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetDefaultReceiver) {
JSFunction* function = JSFunction::cast(callable);
SharedFunctionInfo* shared = function->shared();
- if (shared->native() || !shared->is_classic_mode()) {
+ if (shared->native() || !shared->is_sloppy_mode()) {
return isolate->heap()->undefined_value();
}
// Returns undefined for strict or native functions, or
@@ -5273,7 +5272,7 @@ Handle<Object> Runtime::ForceSetObjectProperty(Isolate* isolate,
return value;
}
- return JSObject::SetElement(js_object, index, value, attr, kNonStrictMode,
+ return JSObject::SetElement(js_object, index, value, attr, kSloppyMode,
false,
DEFINE_PROPERTY);
}
@@ -5281,7 +5280,7 @@ Handle<Object> Runtime::ForceSetObjectProperty(Isolate* isolate,
if (key->IsName()) {
Handle<Name> name = Handle<Name>::cast(key);
if (name->AsArrayIndex(&index)) {
- return JSObject::SetElement(js_object, index, value, attr, kNonStrictMode,
+ return JSObject::SetElement(js_object, index, value, attr, kSloppyMode,
false,
DEFINE_PROPERTY);
} else {
@@ -5299,7 +5298,7 @@ Handle<Object> Runtime::ForceSetObjectProperty(Isolate* isolate,
Handle<String> name = Handle<String>::cast(converted);
if (name->AsArrayIndex(&index)) {
- return JSObject::SetElement(js_object, index, value, attr, kNonStrictMode,
+ return JSObject::SetElement(js_object, index, value, attr, kSloppyMode,
false,
DEFINE_PROPERTY);
} else {
@@ -5366,7 +5365,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) {
PropertyAttributes attributes =
static_cast<PropertyAttributes>(unchecked_attributes);
- StrictModeFlag strict_mode = kNonStrictMode;
+ StrictModeFlag strict_mode = kSloppyMode;
if (args.length() == 5) {
CONVERT_STRICT_MODE_ARG_CHECKED(strict_mode_flag, 4);
strict_mode = strict_mode_flag;
@@ -5990,7 +5989,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetArgumentsProperty) {
if (key->Equals(isolate->heap()->length_string())) return Smi::FromInt(n);
if (key->Equals(isolate->heap()->callee_string())) {
JSFunction* function = frame->function();
- if (!function->shared()->is_classic_mode()) {
+ if (!function->shared()->is_sloppy_mode()) {
return isolate->Throw(*isolate->factory()->NewTypeError(
"strict_arguments_callee", HandleVector<Object>(NULL, 0)));
}
@@ -7975,11 +7974,11 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_NewArgumentsFast) {
Handle<FixedArray> parameter_map =
isolate->factory()->NewFixedArray(mapped_count + 2, NOT_TENURED);
parameter_map->set_map(
- isolate->heap()->non_strict_arguments_elements_map());
+ isolate->heap()->sloppy_arguments_elements_map());
Handle<Map> old_map(result->map());
Handle<Map> new_map = isolate->factory()->CopyMap(old_map);
- new_map->set_elements_kind(NON_STRICT_ARGUMENTS_ELEMENTS);
+ new_map->set_elements_kind(SLOPPY_ARGUMENTS_ELEMENTS);
result->set_map(*new_map);
result->set_elements(*parameter_map);
@@ -9348,8 +9347,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) {
CONVERT_ARG_HANDLE_CHECKED(Context, context, 1);
CONVERT_ARG_HANDLE_CHECKED(String, name, 2);
CONVERT_LANGUAGE_MODE_ARG(language_mode, 3);
- StrictModeFlag strict_mode = (language_mode == CLASSIC_MODE)
- ? kNonStrictMode : kStrictMode;
+ StrictModeFlag strict_mode = (language_mode == SLOPPY_MODE)
+ ? kSloppyMode : kStrictMode;
int index;
PropertyAttributes attributes;
@@ -9405,7 +9404,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) {
"not_defined", HandleVector(&name, 1));
return isolate->Throw(*error);
}
- // In non-strict mode, the property is added to the global object.
+ // In sloppy mode, the property is added to the global object.
attributes = NONE;
object = Handle<JSReceiver>(isolate->context()->global_object());
}
@@ -9755,7 +9754,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_CompileString) {
ParseRestriction restriction = function_literal_only
? ONLY_SINGLE_FUNCTION_LITERAL : NO_PARSE_RESTRICTION;
Handle<JSFunction> fun = Compiler::GetFunctionFromEval(
- source, context, CLASSIC_MODE, restriction, RelocInfo::kNoPosition);
+ source, context, SLOPPY_MODE, restriction, RelocInfo::kNoPosition);
RETURN_IF_EMPTY_HANDLE(isolate, fun);
return *fun;
}
@@ -9877,7 +9876,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_PushIfAbsent) {
// Strict not needed. Used for cycle detection in Array join implementation.
RETURN_IF_EMPTY_HANDLE(isolate, JSObject::SetFastElement(array, length,
element,
- kNonStrictMode,
+ kSloppyMode,
true));
return isolate->heap()->true_value();
}
@@ -10062,7 +10061,7 @@ static uint32_t EstimateElementCount(Handle<JSArray> array) {
}
break;
}
- case NON_STRICT_ARGUMENTS_ELEMENTS:
+ case SLOPPY_ARGUMENTS_ELEMENTS:
#define TYPED_ARRAY_CASE(Type, type, TYPE, ctype, size) \
case EXTERNAL_##TYPE##_ELEMENTS: \
case TYPE##_ELEMENTS: \
@@ -11349,7 +11348,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetFrameDetails) {
// THE FRAME ITERATOR TO WRAP THE RECEIVER.
Handle<Object> receiver(it.frame()->receiver(), isolate);
if (!receiver->IsJSObject() &&
- shared->is_classic_mode() &&
+ shared->is_sloppy_mode() &&
!function->IsBuiltin()) {
// If the receiver is not a JSObject and the function is not a
// builtin or strict-mode we have hit an optimization where a
@@ -11402,7 +11401,7 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector(
RETURN_IF_EMPTY_HANDLE_VALUE(
isolate,
Runtime::SetObjectProperty(
- isolate, target, name, value, NONE, kNonStrictMode),
+ isolate, target, name, value, NONE, kSloppyMode),
Handle<JSObject>());
}
@@ -11415,7 +11414,7 @@ static Handle<JSObject> MaterializeStackLocalsWithFrameInspector(
RETURN_IF_EMPTY_HANDLE_VALUE(
isolate,
Runtime::SetObjectProperty(
- isolate, target, name, value, NONE, kNonStrictMode),
+ isolate, target, name, value, NONE, kSloppyMode),
Handle<JSObject>());
}
@@ -11498,7 +11497,7 @@ static Handle<JSObject> MaterializeLocalContext(Isolate* isolate,
key,
GetProperty(isolate, ext, key),
NONE,
- kNonStrictMode),
+ kSloppyMode),
Handle<JSObject>());
}
}
@@ -11600,7 +11599,7 @@ static bool SetLocalVariableValue(Isolate* isolate,
// property value.
Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
NONE,
- kNonStrictMode);
+ kSloppyMode);
return true;
}
}
@@ -11649,7 +11648,7 @@ static Handle<JSObject> MaterializeClosure(Isolate* isolate,
Runtime::SetObjectProperty(isolate, closure_scope, key,
GetProperty(isolate, ext, key),
NONE,
- kNonStrictMode),
+ kSloppyMode),
Handle<JSObject>());
}
}
@@ -11682,7 +11681,7 @@ static bool SetClosureVariableValue(Isolate* isolate,
// We don't expect this to do anything except replacing property value.
Runtime::SetObjectProperty(isolate, ext, variable_name, new_value,
NONE,
- kNonStrictMode);
+ kSloppyMode);
return true;
}
}
@@ -11705,7 +11704,7 @@ static Handle<JSObject> MaterializeCatchScope(Isolate* isolate,
isolate,
Runtime::SetObjectProperty(isolate, catch_scope, name, thrown_object,
NONE,
- kNonStrictMode),
+ kSloppyMode),
Handle<JSObject>());
return catch_scope;
}
@@ -12218,7 +12217,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_GetStepInPositions) {
Smi* position_value = Smi::FromInt(break_location_iterator.position());
JSObject::SetElement(array, len,
Handle<Object>(position_value, isolate),
- NONE, kNonStrictMode);
+ NONE, kSloppyMode);
len++;
}
}
@@ -12727,7 +12726,7 @@ static Handle<JSObject> MaterializeArgumentsObject(
isolate->factory()->arguments_string(),
arguments,
::NONE,
- kNonStrictMode);
+ kSloppyMode);
return target;
}
@@ -12747,7 +12746,7 @@ static MaybeObject* DebugEvaluate(Isolate* isolate,
Handle<JSFunction> eval_fun =
Compiler::GetFunctionFromEval(source,
context,
- CLASSIC_MODE,
+ SLOPPY_MODE,
NO_PARSE_RESTRICTION,
RelocInfo::kNoPosition);
RETURN_IF_EMPTY_HANDLE(isolate, eval_fun);
@@ -14595,7 +14594,7 @@ ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastSmiOrObjectElements)
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastDoubleElements)
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastHoleyElements)
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(DictionaryElements)
-ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(NonStrictArgumentsElements)
+ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(SloppyArgumentsElements)
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(ExternalArrayElements)
// Properties test sitting with elements tests - not fooling anyone.
ELEMENTS_KIND_CHECK_RUNTIME_FUNCTION(FastProperties)
« src/preparser.h ('K') | « src/runtime.h ('k') | src/scopeinfo.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698