Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(124)

Unified Diff: src/runtime.cc

Issue 236133005: Handlify Runtime::InitializeIntrinsicFunctionNames. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: addressed comments. Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index 7ce8b79c3011ed3730e2290138f56952264c729e..c72aaa289a493ebc4e0471127b7e5ab324e89c39 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::Add(
+ 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;
}
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698