| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "src/v8.h" | 5 #include "src/v8.h" |
| 6 | 6 |
| 7 #include "src/runtime/runtime.h" | 7 #include "src/runtime/runtime.h" |
| 8 #include "src/runtime/runtime-utils.h" | 8 #include "src/runtime/runtime-utils.h" |
| 9 | 9 |
| 10 namespace v8 { | 10 namespace v8 { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 | 49 |
| 50 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, | 50 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, |
| 51 Handle<NameDictionary> dict) { | 51 Handle<NameDictionary> dict) { |
| 52 DCHECK(dict->NumberOfElements() == 0); | 52 DCHECK(dict->NumberOfElements() == 0); |
| 53 HandleScope scope(isolate); | 53 HandleScope scope(isolate); |
| 54 for (int i = 0; i < kNumFunctions; ++i) { | 54 for (int i = 0; i < kNumFunctions; ++i) { |
| 55 const char* name = kIntrinsicFunctions[i].name; | 55 const char* name = kIntrinsicFunctions[i].name; |
| 56 if (name == NULL) continue; | 56 if (name == NULL) continue; |
| 57 Handle<NameDictionary> new_dict = NameDictionary::Add( | 57 Handle<NameDictionary> new_dict = NameDictionary::Add( |
| 58 dict, isolate->factory()->InternalizeUtf8String(name), | 58 dict, isolate->factory()->InternalizeUtf8String(name), |
| 59 Handle<Smi>(Smi::FromInt(i), isolate), PropertyDetails(NONE, DATA, 0)); | 59 Handle<Smi>(Smi::FromInt(i), isolate), |
| 60 PropertyDetails(NONE, DATA, 0, PropertyCellType::kInvalid)); |
| 60 // The dictionary does not need to grow. | 61 // The dictionary does not need to grow. |
| 61 CHECK(new_dict.is_identical_to(dict)); | 62 CHECK(new_dict.is_identical_to(dict)); |
| 62 } | 63 } |
| 63 } | 64 } |
| 64 | 65 |
| 65 | 66 |
| 66 const Runtime::Function* Runtime::FunctionForName(Handle<String> name) { | 67 const Runtime::Function* Runtime::FunctionForName(Handle<String> name) { |
| 67 Heap* heap = name->GetHeap(); | 68 Heap* heap = name->GetHeap(); |
| 68 int entry = heap->intrinsic_function_names()->FindEntry(name); | 69 int entry = heap->intrinsic_function_names()->FindEntry(name); |
| 69 if (entry != kNotFound) { | 70 if (entry != kNotFound) { |
| (...skipping 19 matching lines...) Expand all Loading... |
| 89 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 90 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
| 90 } | 91 } |
| 91 | 92 |
| 92 | 93 |
| 93 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { | 94 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { |
| 94 return os << Runtime::FunctionForId(id)->name; | 95 return os << Runtime::FunctionForId(id)->name; |
| 95 } | 96 } |
| 96 | 97 |
| 97 } // namespace internal | 98 } // namespace internal |
| 98 } // namespace v8 | 99 } // namespace v8 |
| OLD | NEW |