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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 | 73 |
74 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, | 74 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, |
75 Handle<NameDictionary> dict) { | 75 Handle<NameDictionary> dict) { |
76 DCHECK(dict->NumberOfElements() == 0); | 76 DCHECK(dict->NumberOfElements() == 0); |
77 HandleScope scope(isolate); | 77 HandleScope scope(isolate); |
78 for (int i = 0; i < kNumFunctions; ++i) { | 78 for (int i = 0; i < kNumFunctions; ++i) { |
79 const char* name = kIntrinsicFunctions[i].name; | 79 const char* name = kIntrinsicFunctions[i].name; |
80 if (name == NULL) continue; | 80 if (name == NULL) continue; |
81 Handle<NameDictionary> new_dict = NameDictionary::Add( | 81 Handle<NameDictionary> new_dict = NameDictionary::Add( |
82 dict, isolate->factory()->InternalizeUtf8String(name), | 82 dict, isolate->factory()->InternalizeUtf8String(name), |
83 Handle<Smi>(Smi::FromInt(i), isolate), PropertyDetails(NONE, FIELD, 0)); | 83 Handle<Smi>(Smi::FromInt(i), isolate), PropertyDetails(NONE, DATA, 0)); |
84 // The dictionary does not need to grow. | 84 // The dictionary does not need to grow. |
85 CHECK(new_dict.is_identical_to(dict)); | 85 CHECK(new_dict.is_identical_to(dict)); |
86 } | 86 } |
87 } | 87 } |
88 | 88 |
89 | 89 |
90 const Runtime::Function* Runtime::FunctionForName(Handle<String> name) { | 90 const Runtime::Function* Runtime::FunctionForName(Handle<String> name) { |
91 Heap* heap = name->GetHeap(); | 91 Heap* heap = name->GetHeap(); |
92 int entry = heap->intrinsic_function_names()->FindEntry(name); | 92 int entry = heap->intrinsic_function_names()->FindEntry(name); |
93 if (entry != kNotFound) { | 93 if (entry != kNotFound) { |
(...skipping 19 matching lines...) Expand all Loading... |
113 return &(kIntrinsicFunctions[static_cast<int>(id)]); | 113 return &(kIntrinsicFunctions[static_cast<int>(id)]); |
114 } | 114 } |
115 | 115 |
116 | 116 |
117 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { | 117 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { |
118 return os << Runtime::FunctionForId(id)->name; | 118 return os << Runtime::FunctionForId(id)->name; |
119 } | 119 } |
120 | 120 |
121 } // namespace internal | 121 } // namespace internal |
122 } // namespace v8 | 122 } // namespace v8 |
OLD | NEW |