Index: src/runtime.cc |
diff --git a/src/runtime.cc b/src/runtime.cc |
index 7ce8b79c3011ed3730e2290138f56952264c729e..bd746913429b1a604f80a5b1daad053bd9adce4c 100644 |
--- a/src/runtime.cc |
+++ b/src/runtime.cc |
@@ -15089,31 +15089,21 @@ static const Runtime::Function kIntrinsicFunctions[] = { |
#undef F |
-MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap, |
- Object* dictionary) { |
- ASSERT(dictionary != NULL); |
- ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0); |
+void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, |
+ Handle<NameDictionary> dict) { |
+ ASSERT(dict->NumberOfElements() == 0); |
+ HandleScope scope(isolate); |
for (int i = 0; i < kNumFunctions; ++i) { |
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; |
- } |
- } |
+ Handle<NameDictionary> new_dict = NameDictionary::AddNameEntry( |
+ dict, |
+ isolate->factory()->InternalizeUtf8String(name), |
+ Handle<Smi>(Smi::FromInt(i), isolate), |
+ PropertyDetails(NONE, NORMAL, Representation::None())); |
+ // The dictionary does not need to grow. |
+ CHECK(new_dict.is_identical_to(dict)); |
} |
- return dictionary; |
} |