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
This commit is contained in:
keuchel@chromium.org 2011-10-28 09:10:29 +00:00
parent 6d950a748f
commit a9a97d010e
5 changed files with 30 additions and 24 deletions

View File

@ -364,11 +364,7 @@ template <typename T, class P = FreeStoreAllocationPolicy> class List;
// The Strict Mode (ECMA-262 5th edition, 4.2.2).
enum StrictModeFlag {
kNonStrictMode,
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
kStrictMode
};

View File

@ -10524,8 +10524,10 @@ class StringSharedKey : public HashTableKey {
FixedArray* pair = FixedArray::cast(other);
SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0));
if (shared != shared_) return false;
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(
Smi::cast(pair->get(2))->value());
int strict_unchecked = 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;
String* source = String::cast(pair->get(1));
return source->Equals(source_);
@ -10557,8 +10559,10 @@ class StringSharedKey : public HashTableKey {
FixedArray* pair = FixedArray::cast(obj);
SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0));
String* source = String::cast(pair->get(1));
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(
Smi::cast(pair->get(2))->value());
int strict_unchecked = 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);
}

View File

@ -77,6 +77,8 @@ class FunctionEntry BASE_EMBEDDED {
int literal_count() { return backing_[kLiteralCountOffset]; }
int property_count() { return backing_[kPropertyCountOffset]; }
StrictModeFlag strict_mode_flag() {
ASSERT(backing_[kStrictModeOffset] == kStrictMode ||
backing_[kStrictModeOffset] == kNonStrictMode);
return static_cast<StrictModeFlag>(backing_[kStrictModeOffset]);
}

View File

@ -106,6 +106,16 @@ namespace internal {
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,
JSObject* boilerplate) {
StackLimitCheck check(isolate);
@ -1515,8 +1525,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_InitializeVarGlobal) {
CONVERT_ARG_CHECKED(String, name, 0);
GlobalObject* global = isolate->context()->global();
RUNTIME_ASSERT(args[1]->IsSmi());
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(args.smi_at(1));
ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode);
CONVERT_STRICT_MODE_ARG(strict_mode, 1);
// According to ECMA-262, section 12.2, page 62, the property must
// not be deletable.
@ -4594,10 +4603,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_SetProperty) {
StrictModeFlag strict_mode = kNonStrictMode;
if (args.length() == 5) {
CONVERT_SMI_ARG_CHECKED(strict_unchecked, 4);
RUNTIME_ASSERT(strict_unchecked == kStrictMode ||
strict_unchecked == kNonStrictMode);
strict_mode = static_cast<StrictModeFlag>(strict_unchecked);
CONVERT_STRICT_MODE_ARG(strict_mode_flag, 4);
strict_mode = strict_mode_flag;
}
return Runtime::SetObjectProperty(isolate,
@ -9011,10 +9018,7 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_StoreContextSlot) {
Handle<Object> value(args[0], isolate);
CONVERT_ARG_CHECKED(Context, context, 1);
CONVERT_ARG_CHECKED(String, name, 2);
CONVERT_SMI_ARG_CHECKED(strict_unchecked, 3);
RUNTIME_ASSERT(strict_unchecked == kStrictMode ||
strict_unchecked == kNonStrictMode);
StrictModeFlag strict_mode = static_cast<StrictModeFlag>(strict_unchecked);
CONVERT_STRICT_MODE_ARG(strict_mode, 3);
int index;
PropertyAttributes attributes;
@ -9487,11 +9491,11 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEval) {
return MakePair(*callee, isolate->heap()->the_hole_value());
}
ASSERT(args[3]->IsSmi());
CONVERT_STRICT_MODE_ARG(strict_mode, 3);
return CompileGlobalEval(isolate,
args.at<String>(1),
args.at<Object>(2),
static_cast<StrictModeFlag>(args.smi_at(3)));
strict_mode);
}
@ -9508,11 +9512,11 @@ RUNTIME_FUNCTION(ObjectPair, Runtime_ResolvePossiblyDirectEvalNoLookup) {
return MakePair(*callee, isolate->heap()->the_hole_value());
}
ASSERT(args[3]->IsSmi());
CONVERT_STRICT_MODE_ARG(strict_mode, 3);
return CompileGlobalEval(isolate,
args.at<String>(1),
args.at<Object>(2),
static_cast<StrictModeFlag>(args.smi_at(3)));
strict_mode);
}

View File

@ -1213,8 +1213,8 @@ RUNTIME_FUNCTION(MaybeObject*, StoreInterceptorProperty) {
JSObject* recv = JSObject::cast(args[0]);
String* name = String::cast(args[1]);
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));
ASSERT(strict_mode == kStrictMode || strict_mode == kNonStrictMode);
ASSERT(recv->HasNamedInterceptor());
PropertyAttributes attr = NONE;
MaybeObject* result = recv->SetPropertyWithInterceptor(