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

Side by Side Diff: src/runtime.cc

Issue 236343005: Revert "Handlify Runtime::InitializeIntrinsicFunctionNames." (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/runtime.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 15071 matching lines...) Expand 10 before | Expand all | Expand 10 after
15082 INLINE_FUNCTION_LIST(I) 15082 INLINE_FUNCTION_LIST(I)
15083 INLINE_OPTIMIZED_FUNCTION_LIST(IO) 15083 INLINE_OPTIMIZED_FUNCTION_LIST(IO)
15084 }; 15084 };
15085 15085
15086 #undef IO 15086 #undef IO
15087 #undef I 15087 #undef I
15088 #undef FH 15088 #undef FH
15089 #undef F 15089 #undef F
15090 15090
15091 15091
15092 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, 15092 MaybeObject* Runtime::InitializeIntrinsicFunctionNames(Heap* heap,
15093 Handle<NameDictionary> dict) { 15093 Object* dictionary) {
15094 ASSERT(dict->NumberOfElements() == 0); 15094 ASSERT(dictionary != NULL);
15095 HandleScope scope(isolate); 15095 ASSERT(NameDictionary::cast(dictionary)->NumberOfElements() == 0);
15096 for (int i = 0; i < kNumFunctions; ++i) { 15096 for (int i = 0; i < kNumFunctions; ++i) {
15097 const char* name = kIntrinsicFunctions[i].name; 15097 const char* name = kIntrinsicFunctions[i].name;
15098 if (name == NULL) continue; 15098 if (name == NULL) continue;
15099 Handle<NameDictionary> new_dict = NameDictionary::Add( 15099 Object* name_string;
15100 dict, 15100 { MaybeObject* maybe_name_string =
15101 isolate->factory()->InternalizeUtf8String(name), 15101 heap->InternalizeUtf8String(name);
15102 Handle<Smi>(Smi::FromInt(i), isolate), 15102 if (!maybe_name_string->ToObject(&name_string)) return maybe_name_string;
15103 PropertyDetails(NONE, NORMAL, Representation::None())); 15103 }
15104 // The dictionary does not need to grow. 15104 NameDictionary* name_dictionary = NameDictionary::cast(dictionary);
15105 CHECK(new_dict.is_identical_to(dict)); 15105 { MaybeObject* maybe_dictionary = name_dictionary->Add(
15106 String::cast(name_string),
15107 Smi::FromInt(i),
15108 PropertyDetails(NONE, NORMAL, Representation::None()));
15109 if (!maybe_dictionary->ToObject(&dictionary)) {
15110 // Non-recoverable failure. Calling code must restart heap
15111 // initialization.
15112 return maybe_dictionary;
15113 }
15114 }
15106 } 15115 }
15116 return dictionary;
15107 } 15117 }
15108 15118
15109 15119
15110 const Runtime::Function* Runtime::FunctionForName(Handle<String> name) { 15120 const Runtime::Function* Runtime::FunctionForName(Handle<String> name) {
15111 Heap* heap = name->GetHeap(); 15121 Heap* heap = name->GetHeap();
15112 int entry = heap->intrinsic_function_names()->FindEntry(*name); 15122 int entry = heap->intrinsic_function_names()->FindEntry(*name);
15113 if (entry != kNotFound) { 15123 if (entry != kNotFound) {
15114 Object* smi_index = heap->intrinsic_function_names()->ValueAt(entry); 15124 Object* smi_index = heap->intrinsic_function_names()->ValueAt(entry);
15115 int function_index = Smi::cast(smi_index)->value(); 15125 int function_index = Smi::cast(smi_index)->value();
15116 return &(kIntrinsicFunctions[function_index]); 15126 return &(kIntrinsicFunctions[function_index]);
(...skipping 27 matching lines...) Expand all
15144 } 15154 }
15145 } 15155 }
15146 15156
15147 15157
15148 void Runtime::OutOfMemory() { 15158 void Runtime::OutOfMemory() {
15149 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true); 15159 Heap::FatalProcessOutOfMemory("CALL_AND_RETRY_LAST", true);
15150 UNREACHABLE(); 15160 UNREACHABLE();
15151 } 15161 }
15152 15162
15153 } } // namespace v8::internal 15163 } } // namespace v8::internal
OLDNEW
« 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