Index: src/objects.cc |
diff --git a/src/objects.cc b/src/objects.cc |
index 81623f6df9ad2f5d393b292055a89bd5cad9443e..3af9a5f5ab9b7dda3ada4485e73f9bc4f83b05a2 100644 |
--- a/src/objects.cc |
+++ b/src/objects.cc |
@@ -7263,18 +7263,19 @@ MaybeObject* JSFunction::SetPrototype(Object* value) { |
Object* JSFunction::RemovePrototype() { |
Context* global_context = context()->global_context(); |
- Map* no_prototype_map = shared()->strict_mode() |
- ? global_context->strict_mode_function_without_prototype_map() |
- : global_context->function_without_prototype_map(); |
+ Map* no_prototype_map = shared()->is_classic_mode() |
+ ? global_context->function_without_prototype_map() |
+ : global_context->strict_mode_function_without_prototype_map(); |
if (map() == no_prototype_map) { |
// Be idempotent. |
return this; |
} |
- ASSERT(!shared()->strict_mode() || |
+ ASSERT(shared()->is_classic_mode() || |
map() == global_context->strict_mode_function_map()); |
- ASSERT(shared()->strict_mode() || map() == global_context->function_map()); |
+ ASSERT(!shared()->is_classic_mode() || |
+ map() == global_context->function_map()); |
rossberg
2011/11/09 12:15:29
Nit: These two assertions could be a single
map()
|
set_map(no_prototype_map); |
set_prototype_or_initial_map(no_prototype_map->GetHeap()->the_hole_value()); |
@@ -10502,28 +10503,26 @@ class StringSharedKey : public HashTableKey { |
public: |
StringSharedKey(String* source, |
SharedFunctionInfo* shared, |
- StrictModeFlag strict_mode) |
+ LanguageMode language_mode) |
: source_(source), |
shared_(shared), |
- strict_mode_(strict_mode) { } |
+ language_mode_(language_mode) { } |
bool IsMatch(Object* other) { |
if (!other->IsFixedArray()) return false; |
FixedArray* pair = FixedArray::cast(other); |
SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0)); |
if (shared != shared_) return false; |
- 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; |
+ int language_unchecked = Smi::cast(pair->get(2))->value(); |
+ LanguageMode language_mode = static_cast<LanguageMode>(language_unchecked); |
+ if (language_mode != language_mode_) return false; |
String* source = String::cast(pair->get(1)); |
return source->Equals(source_); |
} |
static uint32_t StringSharedHashHelper(String* source, |
SharedFunctionInfo* shared, |
- StrictModeFlag strict_mode) { |
+ LanguageMode language_mode) { |
uint32_t hash = source->Hash(); |
if (shared->HasSourceCode()) { |
// Instead of using the SharedFunctionInfo pointer in the hash |
@@ -10533,25 +10532,27 @@ class StringSharedKey : public HashTableKey { |
// collection. |
Script* script = Script::cast(shared->script()); |
hash ^= String::cast(script->source())->Hash(); |
- if (strict_mode == kStrictMode) hash ^= 0x8000; |
+ if (language_mode == STRICT_MODE) hash ^= 0x8000; |
+ if (language_mode == EXTENDED_MODE) hash ^= 0x0080; |
hash += shared->start_position(); |
} |
return hash; |
} |
uint32_t Hash() { |
- return StringSharedHashHelper(source_, shared_, strict_mode_); |
+ return StringSharedHashHelper(source_, shared_, language_mode_); |
} |
uint32_t HashForObject(Object* obj) { |
FixedArray* pair = FixedArray::cast(obj); |
SharedFunctionInfo* shared = SharedFunctionInfo::cast(pair->get(0)); |
String* source = String::cast(pair->get(1)); |
- 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); |
+ int language_unchecked = Smi::cast(pair->get(2))->value(); |
+ ASSERT(language_unchecked == CLASSIC_MODE || |
+ language_unchecked == STRICT_MODE || |
+ language_unchecked == EXTENDED_MODE); |
+ LanguageMode language_mode = static_cast<LanguageMode>(language_unchecked); |
+ return StringSharedHashHelper(source, shared, language_mode); |
} |
MUST_USE_RESULT MaybeObject* AsObject() { |
@@ -10562,14 +10563,14 @@ class StringSharedKey : public HashTableKey { |
FixedArray* pair = FixedArray::cast(obj); |
pair->set(0, shared_); |
pair->set(1, source_); |
- pair->set(2, Smi::FromInt(strict_mode_)); |
+ pair->set(2, Smi::FromInt(language_mode_)); |
return pair; |
} |
private: |
String* source_; |
SharedFunctionInfo* shared_; |
- StrictModeFlag strict_mode_; |
+ LanguageMode language_mode_; |
}; |
@@ -11724,8 +11725,8 @@ Object* CompilationCacheTable::Lookup(String* src) { |
Object* CompilationCacheTable::LookupEval(String* src, |
Context* context, |
- StrictModeFlag strict_mode) { |
- StringSharedKey key(src, context->closure()->shared(), strict_mode); |
+ LanguageMode language_mode) { |
+ StringSharedKey key(src, context->closure()->shared(), language_mode); |
int entry = FindEntry(&key); |
if (entry == kNotFound) return GetHeap()->undefined_value(); |
return get(EntryToIndex(entry) + 1); |
@@ -11763,7 +11764,7 @@ MaybeObject* CompilationCacheTable::PutEval(String* src, |
SharedFunctionInfo* value) { |
StringSharedKey key(src, |
context->closure()->shared(), |
- value->strict_mode_flag()); |
+ value->language_mode()); |
Object* obj; |
{ MaybeObject* maybe_obj = EnsureCapacity(1, &key); |
if (!maybe_obj->ToObject(&obj)) return maybe_obj; |