| OLD | NEW |
| 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 15080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 15091 #undef F | 15091 #undef F |
| 15092 | 15092 |
| 15093 | 15093 |
| 15094 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, | 15094 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, |
| 15095 Handle<NameDictionary> dict) { | 15095 Handle<NameDictionary> dict) { |
| 15096 ASSERT(dict->NumberOfElements() == 0); | 15096 ASSERT(dict->NumberOfElements() == 0); |
| 15097 HandleScope scope(isolate); | 15097 HandleScope scope(isolate); |
| 15098 for (int i = 0; i < kNumFunctions; ++i) { | 15098 for (int i = 0; i < kNumFunctions; ++i) { |
| 15099 const char* name = kIntrinsicFunctions[i].name; | 15099 const char* name = kIntrinsicFunctions[i].name; |
| 15100 if (name == NULL) continue; | 15100 if (name == NULL) continue; |
| 15101 Handle<NameDictionary> new_dict = NameDictionary::AddNameEntry( | 15101 Handle<NameDictionary> new_dict = NameDictionary::Add( |
| 15102 dict, | 15102 dict, |
| 15103 isolate->factory()->InternalizeUtf8String(name), | 15103 *isolate->factory()->InternalizeUtf8String(name), |
| 15104 Handle<Smi>(Smi::FromInt(i), isolate), | 15104 Handle<Smi>(Smi::FromInt(i), isolate), |
| 15105 PropertyDetails(NONE, NORMAL, Representation::None())); | 15105 PropertyDetails(NONE, NORMAL, Representation::None())); |
| 15106 // The dictionary does not need to grow. | 15106 // The dictionary does not need to grow. |
| 15107 CHECK(new_dict.is_identical_to(dict)); | 15107 CHECK(new_dict.is_identical_to(dict)); |
| 15108 } | 15108 } |
| 15109 } | 15109 } |
| 15110 | 15110 |
| 15111 | 15111 |
| 15112 const Runtime::Function* Runtime::FunctionForName(Handle<String> name) { | 15112 const Runtime::Function* Runtime::FunctionForName(Handle<String> name) { |
| 15113 Heap* heap = name->GetHeap(); | 15113 Heap* heap = name->GetHeap(); |
| 15114 int entry = heap->intrinsic_function_names()->FindEntry(*name); | 15114 int entry = heap->intrinsic_function_names()->FindEntry(*name); |
| 15115 if (entry != kNotFound) { | 15115 if (entry != kNotFound) { |
| 15116 Object* smi_index = heap->intrinsic_function_names()->ValueAt(entry); | 15116 Object* smi_index = heap->intrinsic_function_names()->ValueAt(entry); |
| 15117 int function_index = Smi::cast(smi_index)->value(); | 15117 int function_index = Smi::cast(smi_index)->value(); |
| 15118 return &(kIntrinsicFunctions[function_index]); | 15118 return &(kIntrinsicFunctions[function_index]); |
| 15119 } | 15119 } |
| 15120 return NULL; | 15120 return NULL; |
| 15121 } | 15121 } |
| 15122 | 15122 |
| 15123 | 15123 |
| 15124 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { | 15124 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { |
| 15125 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 15125 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 15126 } | 15126 } |
| 15127 | 15127 |
| 15128 } } // namespace v8::internal | 15128 } } // namespace v8::internal |
| OLD | NEW |