Commit a9a97d01 authored by keuchel@chromium.org's avatar keuchel@chromium.org

Remove kInvalidStrictFlag and make gcc-4.5 happy again.

Review URL: http://codereview.chromium.org/8403036

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@9832 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 6d950a74
...@@ -364,11 +364,7 @@ template <typename T, class P = FreeStoreAllocationPolicy> class List; ...@@ -364,11 +364,7 @@ template <typename T, class P = FreeStoreAllocationPolicy> class List;
// The Strict Mode (ECMA-262 5th edition, 4.2.2). // The Strict Mode (ECMA-262 5th edition, 4.2.2).
enum StrictModeFlag { enum StrictModeFlag {
kNonStrictMode, kNonStrictMode,
kStrictMode, kStrictMode
// This value is never used, but is needed to prevent GCC 4.5 from failing
// to compile when we assert that a flag is either kNonStrictMode or
// kStrictMode.
kInvalidStrictFlag
}; };
......
...@@ -10524,8 +10524,10 @@ class StringSharedKey : public HashTableKey { ...@@ -10524,8 +10524,10 @@ class StringSharedKey : public HashTableKey {
FixedArray* pair = FixedArray::cast(other); FixedArray* pair = FixedArray::cast(other);
SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0)); SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0));
if (shared != shared_) return false; if (shared != shared_) return false;
StrictModeFlag strict_mode = static_cast<StrictModeFlag>( int strict_unchecked = Smi::cast(pair->get(2))->value();
Smi::cast(pair->get(2))->value()); ASSERT(strict_unchecked == kStrictMode ||
strict_unchecked == kNonStrictMode);
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(strict_unchecked);
if (strict_mode != strict_mode_) return false; if (strict_mode != strict_mode_) return false;
String* source = String::cast(pair->get(1)); String* source = String::cast(pair->get(1));
return source->Equals(source_); return source->Equals(source_);
...@@ -10557,8 +10559,10 @@ class StringSharedKey : public HashTableKey { ...@@ -10557,8 +10559,10 @@ class StringSharedKey : public HashTableKey {
FixedArray* pair = FixedArray::cast(obj); FixedArray* pair = FixedArray::cast(obj);
SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0)); SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0));
String* source = String::cast(pair->get(1)); String* source = String::cast(pair->get(1));
StrictModeFlag strict_mode = static_cast<StrictModeFlag>( int strict_unchecked = Smi::cast(pair->get(2))->value();
Smi::cast(pair->get(2))->value()); ASSERT(strict_unchecked == kStrictMode ||
strict_unchecked == kNonStrictMode);
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(strict_unchecked);
return StringSharedHashHelper(source, shared, strict_mode); return StringSharedHashHelper(source, shared, strict_mode);
} }
......
...@@ -77,6 +77,8 @@ class FunctionEntry BASE_EMBEDDED { ...@@ -77,6 +77,8 @@ class FunctionEntry BASE_EMBEDDED {
int literal_count() { return backing_[kLiteralCountOffset]; } int literal_count() { return backing_[kLiteralCountOffset]; }
int property_count() { return backing_[kPropertyCountOffset]; } int property_count() { return backing_[kPropertyCountOffset]; }
StrictModeFlag strict_mode_flag() { StrictModeFlag strict_mode_flag() {
ASSERT(backing_[kStrictModeOffset] == kStrictMode ||
backing_[kStrictModeOffset] == kNonStrictMode);
return static_cast<StrictModeFlag>(backing_[kStrictModeOffset]); return static_cast<StrictModeFlag>(backing_[kStrictModeOffset]);
} }
......
...@@ -106,6 +106,16 @@ namespace internal { ...@@ -106,6 +106,16 @@ namespace internal {
type name = NumberTo##Type(obj); type name = NumberTo##Type(obj);
// Assert that the given argument has a valid value for a StrictModeFlag
// and store it in a StrictModeFlag variable with the given name.
#define CONVERT_STRICT_MODE_ARG(name, index) \
ASSERT(args[index]->IsSmi()); \
ASSERT(args.smi_at(index) == kStrictMode || \
args.smi_at(index) == kNonStrictMode); \
StrictModeFlag name = \
static_cast<StrictModeFlag>(args.smi_at(index));
MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate, MUST_USE_RESULT static MaybeObject* DeepCopyBoilerplate(Isolate* isolate,
JSObject* boilerplate) { JSObject* boilerplate) {
StackLimitCheck check(isolate); StackLimitCheck check(isolate);
...@@ -1515,8 +1525,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) { ...@@ -1515,8 +1525,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
CONVERT_ARG_CHECKED(String, name, 0); CONVERT_ARG_CHECKED(String, name, 0);
GlobalObject* global = isolate->context()->global(); GlobalObject* global = isolate->context()->global();
RUNTIME_ASSERT(args[1]->IsSmi()); RUNTIME_ASSERT(args[1]->IsSmi());
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(1)); CONVERT_STRICT_MODE_ARG(strict_mode, 1);
ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode);
// According to ECMA-262, section 12.2, page 62, the property must // According to ECMA-262, section 12.2, page 62, the property must
// not be deletable. // not be deletable.
...@@ -4594,10 +4603,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) { ...@@ -4594,10 +4603,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) {
StrictModeFlag strict_mode = kNonStrictMode; StrictModeFlag strict_mode = kNonStrictMode;
if (args.length() == 5) { if (args.length() == 5) {
CONVERT_SMI_ARG_CHECKED(strict_unchecked, 4); CONVERT_STRICT_MODE_ARG(strict_mode_flag, 4);
RUNTIME_ASSERT(strict_unchecked == kStrictMode || strict_mode = strict_mode_flag;
strict_unchecked == kNonStrictMode);
strict_mode = static_cast<StrictModeFlag>(strict_unchecked);
} }
return Runtime::SetObjectProperty(isolate, return Runtime::SetObjectProperty(isolate,
...@@ -9011,10 +9018,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) { ...@@ -9011,10 +9018,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) {
Handle<Object> value(args[0], isolate); Handle<Object> value(args[0], isolate);
CONVERT_ARG_CHECKED(Context, context, 1); CONVERT_ARG_CHECKED(Context, context, 1);
CONVERT_ARG_CHECKED(String, name, 2); CONVERT_ARG_CHECKED(String, name, 2);
CONVERT_SMI_ARG_CHECKED(strict_unchecked, 3); CONVERT_STRICT_MODE_ARG(strict_mode, 3);
RUNTIME_ASSERT(strict_unchecked == kStrictMode ||
strict_unchecked == kNonStrictMode);
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(strict_unchecked);
int index; int index;
PropertyAttributes attributes; PropertyAttributes attributes;
...@@ -9487,11 +9491,11 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) { ...@@ -9487,11 +9491,11 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) {
return MakePair(*callee, isolate->heap()->the_hole_value()); return MakePair(*callee, isolate->heap()->the_hole_value());
} }
ASSERT(args[3]->IsSmi()); CONVERT_STRICT_MODE_ARG(strict_mode, 3);
return CompileGlobalEval(isolate, return CompileGlobalEval(isolate,
args.at<String>(1), args.at<String>(1),
args.at<Object>(2), args.at<Object>(2),
static_cast<StrictModeFlag>(args.smi_at(3))); strict_mode);
} }
...@@ -9508,11 +9512,11 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEvalNoLookup) { ...@@ -9508,11 +9512,11 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEvalNoLookup) {
return MakePair(*callee, isolate->heap()->the_hole_value()); return MakePair(*callee, isolate->heap()->the_hole_value());
} }
ASSERT(args[3]->IsSmi()); CONVERT_STRICT_MODE_ARG(strict_mode, 3);
return CompileGlobalEval(isolate, return CompileGlobalEval(isolate,
args.at<String>(1), args.at<String>(1),
args.at<Object>(2), args.at<Object>(2),
static_cast<StrictModeFlag>(args.smi_at(3))); strict_mode);
} }
......
...@@ -1213,8 +1213,8 @@ RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) { ...@@ -1213,8 +1213,8 @@ RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) {
JSObject* recv = JSObject::cast(args[0]); JSObject* recv = JSObject::cast(args[0]);
String* name = String::cast(args[1]); String* name = String::cast(args[1]);
Object* value = args[2]; Object* value = args[2];
ASSERT(args.smi_at(3) == kStrictMode || args.smi_at(3) == kNonStrictMode);
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(3)); StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(3));
ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode);
ASSERT(recv->HasNamedInterceptor()); ASSERT(recv->HasNamedInterceptor());
PropertyAttributes attr = NONE; PropertyAttributes attr = NONE;
MaybeObject* result = recv->SetPropertyWithInterceptor( MaybeObject* result = recv->SetPropertyWithInterceptor(
......
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