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

Side by Side Diff: src/runtime/runtime.cc

Issue 1306993003: Call JS functions via native context instead of js builtins object. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: separated context slot lookup Created 5 years, 3 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
OLDNEW
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/runtime/runtime.h" 5 #include "src/runtime/runtime.h"
6 6
7 #include "src/contexts.h"
7 #include "src/handles-inl.h" 8 #include "src/handles-inl.h"
8 #include "src/heap/heap.h" 9 #include "src/heap/heap.h"
9 #include "src/isolate.h" 10 #include "src/isolate.h"
10 #include "src/runtime/runtime-utils.h" 11 #include "src/runtime/runtime-utils.h"
11 12
12 namespace v8 { 13 namespace v8 {
13 namespace internal { 14 namespace internal {
14 15
15 // Header of runtime functions. 16 // Header of runtime functions.
16 #define F(name, number_of_args, result_size) \ 17 #define F(name, number_of_args, result_size) \
(...skipping 17 matching lines...) Expand all
34 , 35 ,
35 36
36 37
37 #define I(name, number_of_args, result_size) \ 38 #define I(name, number_of_args, result_size) \
38 { \ 39 { \
39 Runtime::kInline##name, Runtime::INLINE, "_" #name, \ 40 Runtime::kInline##name, Runtime::INLINE, "_" #name, \
40 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size \ 41 FUNCTION_ADDR(Runtime_##name), number_of_args, result_size \
41 } \ 42 } \
42 , 43 ,
43 44
44
45 static const Runtime::Function kIntrinsicFunctions[] = { 45 static const Runtime::Function kIntrinsicFunctions[] = {
46 FOR_EACH_INTRINSIC(F) FOR_EACH_INTRINSIC(I)}; 46 FOR_EACH_INTRINSIC(F)
47 FOR_EACH_INTRINSIC(I)
48 };
47 49
48 #undef I 50 #undef I
49 #undef F 51 #undef F
50 52
51 53
52 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate, 54 void Runtime::InitializeIntrinsicFunctionNames(Isolate* isolate,
53 Handle<NameDictionary> dict) { 55 Handle<NameDictionary> dict) {
54 DCHECK(dict->NumberOfElements() == 0); 56 DCHECK(dict->NumberOfElements() == 0);
55 HandleScope scope(isolate); 57 HandleScope scope(isolate);
56 for (int i = 0; i < kNumFunctions; ++i) { 58 for (int i = 0; i < kNumFunctions; ++i) {
(...skipping 15 matching lines...) Expand all
72 Object* smi_index = heap->intrinsic_function_names()->ValueAt(entry); 74 Object* smi_index = heap->intrinsic_function_names()->ValueAt(entry);
73 int function_index = Smi::cast(smi_index)->value(); 75 int function_index = Smi::cast(smi_index)->value();
74 return &(kIntrinsicFunctions[function_index]); 76 return &(kIntrinsicFunctions[function_index]);
75 } 77 }
76 return NULL; 78 return NULL;
77 } 79 }
78 80
79 81
80 const Runtime::Function* Runtime::FunctionForEntry(Address entry) { 82 const Runtime::Function* Runtime::FunctionForEntry(Address entry) {
81 for (size_t i = 0; i < arraysize(kIntrinsicFunctions); ++i) { 83 for (size_t i = 0; i < arraysize(kIntrinsicFunctions); ++i) {
82 if (entry == kIntrinsicFunctions[i].entry) { 84 if (kIntrinsicFunctions[i].intrinsic_type == RUNTIME &&
Michael Starzinger 2015/08/26 09:43:22 Is this needed? This looks fishy to me!
Yang 2015/08/26 10:27:30 Done.
85 entry == kIntrinsicFunctions[i].entry) {
83 return &(kIntrinsicFunctions[i]); 86 return &(kIntrinsicFunctions[i]);
84 } 87 }
85 } 88 }
86 return NULL; 89 return NULL;
87 } 90 }
88 91
89 92
90 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) { 93 const Runtime::Function* Runtime::FunctionForId(Runtime::FunctionId id) {
91 return &(kIntrinsicFunctions[static_cast<int>(id)]); 94 return &(kIntrinsicFunctions[static_cast<int>(id)]);
92 } 95 }
93 96
94 97
95 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) { 98 std::ostream& operator<<(std::ostream& os, Runtime::FunctionId id) {
96 return os << Runtime::FunctionForId(id)->name; 99 return os << Runtime::FunctionForId(id)->name;
97 } 100 }
98 101
99 } // namespace internal 102 } // namespace internal
100 } // namespace v8 103 } // namespace v8
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698