Chromium Code Reviews| Index: src/runtime.cc |
| diff --git a/src/runtime.cc b/src/runtime.cc |
| index 7ce8b79c3011ed3730e2290138f56952264c729e..afa469d7683278a18bad6ffab2b012e5e76e1e7b 100644 |
| --- a/src/runtime.cc |
| +++ b/src/runtime.cc |
| @@ -15089,31 +15089,24 @@ static const Runtime::Function kIntrinsicFunctions[] = { |
| #undef F |
| -MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap, |
| - Object* dictionary) { |
| - ASSERT(dictionary != NULL); |
| - ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0); |
| +Handle<NameDictionary> Runtime::InitializeIntrinsicFunctionNames( |
| + Isolate* isolate, Handle<NameDictionary> dict) { |
| + ASSERT(dict->NumberOfElements() == 0); |
| + ASSERT(dict->Capacity() == kNumFunctions); |
| for (int i = 0; i < kNumFunctions; ++i) { |
| + HandleScope scope(isolate); |
|
Michael Starzinger
2014/04/14 11:10:50
Do we need this handle scope at all? If yes, then
|
| const char* name = kIntrinsicFunctions[i].name; |
| if (name == NULL) continue; |
| - Object* name_string; |
| - { MaybeObject* maybe_name_string = |
| - heap->InternalizeUtf8String(name); |
| - if (!maybe_name_string->ToObject(&name_string)) return maybe_name_string; |
| - } |
| - NameDictionary* name_dictionary = NameDictionary::cast(dictionary); |
| - { MaybeObject* maybe_dictionary = name_dictionary->Add( |
| - String::cast(name_string), |
| - Smi::FromInt(i), |
| - PropertyDetails(NONE, NORMAL, Representation::None())); |
| - if (!maybe_dictionary->ToObject(&dictionary)) { |
| - // Non-recoverable failure. Calling code must restart heap |
| - // initialization. |
| - return maybe_dictionary; |
| - } |
| - } |
| - } |
| - return dictionary; |
| + Handle<NameDictionary> new_dict = NameDictionary::Add( |
| + dict, |
| + isolate->factory()->InternalizeUtf8String(name), |
| + Handle<Smi>(Smi::FromInt(i), isolate), |
| + PropertyDetails(NONE, NORMAL, Representation::None())); |
| + // The dictionary does not need to grow. |
| + ASSERT(new_dict.is_identical_to(dict)); |
| + USE(new_dict); |
| + } |
| + return dict; |
| } |