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 #ifndef V8_CONTEXTS_H_ | 5 #ifndef V8_CONTEXTS_H_ |
6 #define V8_CONTEXTS_H_ | 6 #define V8_CONTEXTS_H_ |
7 | 7 |
8 #include "src/heap/heap.h" | 8 #include "src/heap/heap.h" |
9 #include "src/objects.h" | 9 #include "src/objects.h" |
10 | 10 |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 V(REFLECT_APPLY_INDEX, JSFunction, reflect_apply) \ | 83 V(REFLECT_APPLY_INDEX, JSFunction, reflect_apply) \ |
84 V(REFLECT_CONSTRUCT_INDEX, JSFunction, reflect_construct) \ | 84 V(REFLECT_CONSTRUCT_INDEX, JSFunction, reflect_construct) \ |
85 V(SPREAD_ARGUMENTS_INDEX, JSFunction, spread_arguments) \ | 85 V(SPREAD_ARGUMENTS_INDEX, JSFunction, spread_arguments) \ |
86 V(SPREAD_ITERABLE_INDEX, JSFunction, spread_iterable) \ | 86 V(SPREAD_ITERABLE_INDEX, JSFunction, spread_iterable) \ |
87 V(TO_LENGTH_FUN_INDEX, JSFunction, to_length_fun) \ | 87 V(TO_LENGTH_FUN_INDEX, JSFunction, to_length_fun) \ |
88 V(TO_NAME_INDEX, JSFunction, to_name) \ | 88 V(TO_NAME_INDEX, JSFunction, to_name) \ |
89 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ | 89 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ |
90 V(TO_PRIMITIVE_INDEX, JSFunction, to_primitive) \ | 90 V(TO_PRIMITIVE_INDEX, JSFunction, to_primitive) \ |
91 V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) | 91 V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) |
92 | 92 |
93 | |
94 #define NATIVE_CONTEXT_JS_BUILTINS(V) \ | |
95 V(ADD_BUILTIN_INDEX, JSFunction, add_builtin) \ | |
96 V(ADD_STRONG_BUILTIN_INDEX, JSFunction, add_strong_builtin) \ | |
97 V(APPLY_PREPARE_BUILTIN_INDEX, JSFunction, apply_prepare_builtin) \ | |
98 V(BIT_AND_BUILTIN_INDEX, JSFunction, bit_and_builtin) \ | |
99 V(BIT_AND_STRONG_BUILTIN_INDEX, JSFunction, bit_and_strong_builtin) \ | |
100 V(BIT_OR_BUILTIN_INDEX, JSFunction, bit_or_builtin) \ | |
101 V(BIT_OR_STRONG_BUILTIN_INDEX, JSFunction, bit_or_strong_builtin) \ | |
102 V(BIT_XOR_BUILTIN_INDEX, JSFunction, bit_xor_builtin) \ | |
103 V(BIT_XOR_STRONG_BUILTIN_INDEX, JSFunction, bit_xor_strong_builtin) \ | |
104 V(CALL_FUNCTION_PROXY_AS_CONSTRUCTOR_BUILTIN_INDEX, JSFunction, \ | |
105 call_function_proxy_as_constructor_builtin) \ | |
106 V(CALL_FUNCTION_PROXY_BUILTIN_INDEX, JSFunction, \ | |
107 call_function_proxy_builtin) \ | |
108 V(CALL_NON_FUNCTION_AS_CONSTRUCTOR_BUILTIN_INDEX, JSFunction, \ | |
109 call_non_function_as_constructor_builtin) \ | |
110 V(CALL_NON_FUNCTION_BUILTIN_INDEX, JSFunction, call_non_function_builtin) \ | |
111 V(COMPARE_BUILTIN_INDEX, JSFunction, compare_builtin) \ | |
112 V(COMPARE_STRONG_BUILTIN_INDEX, JSFunction, compare_strong_builtin) \ | |
113 V(CONCAT_ITERABLE_TO_ARRAY_BUILTIN_INDEX, JSFunction, \ | |
114 concat_iterable_to_array_builtin) \ | |
115 V(DIV_BUILTIN_INDEX, JSFunction, div_builtin) \ | |
116 V(DIV_STRONG_BUILTIN_INDEX, JSFunction, div_strong_builtin) \ | |
117 V(EQUALS_BUILTIN_INDEX, JSFunction, equals_builtin) \ | |
118 V(IN_BUILTIN_INDEX, JSFunction, in_builtin) \ | |
119 V(MOD_BUILTIN_INDEX, JSFunction, mod_builtin) \ | |
120 V(MOD_STRONG_BUILTIN_INDEX, JSFunction, mod_strong_builtin) \ | |
121 V(MUL_BUILTIN_INDEX, JSFunction, mul_builtin) \ | |
122 V(MUL_STRONG_BUILTIN_INDEX, JSFunction, mul_strong_builtin) \ | |
123 V(REFLECT_APPLY_PREPARE_BUILTIN_INDEX, JSFunction, \ | |
124 reflect_apply_prepare_builtin) \ | |
125 V(REFLECT_CONSTRUCT_PREPARE_BUILTIN_INDEX, JSFunction, \ | |
126 reflect_construct_prepare_builtin) \ | |
127 V(SAR_BUILTIN_INDEX, JSFunction, sar_builtin) \ | |
128 V(SAR_STRONG_BUILTIN_INDEX, JSFunction, sar_strong_builtin) \ | |
129 V(SHL_BUILTIN_INDEX, JSFunction, shl_builtin) \ | |
130 V(SHL_STRONG_BUILTIN_INDEX, JSFunction, shl_strong_builtin) \ | |
131 V(SHR_BUILTIN_INDEX, JSFunction, shr_builtin) \ | |
132 V(SHR_STRONG_BUILTIN_INDEX, JSFunction, shr_strong_builtin) \ | |
133 V(STACK_OVERFLOW_BUILTIN_INDEX, JSFunction, stack_overflow_builtin) \ | |
134 V(STRING_ADD_LEFT_BUILTIN_INDEX, JSFunction, string_add_left_builtin) \ | |
135 V(STRING_ADD_RIGHT_BUILTIN_INDEX, JSFunction, string_add_right_builtin) \ | |
136 V(SUB_BUILTIN_INDEX, JSFunction, sub_builtin) \ | |
137 V(SUB_STRONG_BUILTIN_INDEX, JSFunction, sub_strong_builtin) \ | |
138 V(TO_NAME_BUILTIN_INDEX, JSFunction, to_name_builtin) \ | |
139 V(TO_NUMBER_BUILTIN_INDEX, JSFunction, to_number_builtin) \ | |
140 V(TO_STRING_BUILTIN_INDEX, JSFunction, to_string_builtin) | |
141 | |
142 | |
93 #define NATIVE_CONTEXT_IMPORTED_FIELDS(V) \ | 143 #define NATIVE_CONTEXT_IMPORTED_FIELDS(V) \ |
94 V(ARRAY_CONCAT_INDEX, JSFunction, array_concat) \ | 144 V(ARRAY_CONCAT_INDEX, JSFunction, array_concat) \ |
95 V(ARRAY_POP_INDEX, JSFunction, array_pop) \ | 145 V(ARRAY_POP_INDEX, JSFunction, array_pop) \ |
96 V(ARRAY_PUSH_INDEX, JSFunction, array_push) \ | 146 V(ARRAY_PUSH_INDEX, JSFunction, array_push) \ |
97 V(ARRAY_SHIFT_INDEX, JSFunction, array_shift) \ | 147 V(ARRAY_SHIFT_INDEX, JSFunction, array_shift) \ |
98 V(ARRAY_SPLICE_INDEX, JSFunction, array_splice) \ | 148 V(ARRAY_SPLICE_INDEX, JSFunction, array_splice) \ |
99 V(ARRAY_SLICE_INDEX, JSFunction, array_slice) \ | 149 V(ARRAY_SLICE_INDEX, JSFunction, array_slice) \ |
100 V(ARRAY_UNSHIFT_INDEX, JSFunction, array_unshift) \ | 150 V(ARRAY_UNSHIFT_INDEX, JSFunction, array_unshift) \ |
101 V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \ | 151 V(ARRAY_VALUES_ITERATOR_INDEX, JSFunction, array_values_iterator) \ |
102 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ | 152 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 V(SET_DELETE_METHOD_INDEX, JSFunction, set_delete) \ | 195 V(SET_DELETE_METHOD_INDEX, JSFunction, set_delete) \ |
146 V(SET_FROM_ARRAY_INDEX, JSFunction, set_from_array) \ | 196 V(SET_FROM_ARRAY_INDEX, JSFunction, set_from_array) \ |
147 V(SET_HAS_METHOD_INDEX, JSFunction, set_has) \ | 197 V(SET_HAS_METHOD_INDEX, JSFunction, set_has) \ |
148 V(STACK_OVERFLOW_BOILERPLATE_INDEX, JSObject, stack_overflow_boilerplate) \ | 198 V(STACK_OVERFLOW_BOILERPLATE_INDEX, JSObject, stack_overflow_boilerplate) \ |
149 V(SYNTAX_ERROR_FUNCTION_INDEX, JSFunction, syntax_error_function) \ | 199 V(SYNTAX_ERROR_FUNCTION_INDEX, JSFunction, syntax_error_function) \ |
150 V(TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, JSFunction, \ | 200 V(TO_COMPLETE_PROPERTY_DESCRIPTOR_INDEX, JSFunction, \ |
151 to_complete_property_descriptor) \ | 201 to_complete_property_descriptor) \ |
152 V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \ | 202 V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \ |
153 V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \ | 203 V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \ |
154 V(TYPE_ERROR_FUNCTION_INDEX, JSFunction, type_error_function) \ | 204 V(TYPE_ERROR_FUNCTION_INDEX, JSFunction, type_error_function) \ |
155 V(URI_ERROR_FUNCTION_INDEX, JSFunction, uri_error_function) | 205 V(URI_ERROR_FUNCTION_INDEX, JSFunction, uri_error_function) \ |
206 NATIVE_CONTEXT_JS_BUILTINS(V) | |
Michael Starzinger
2015/08/26 14:16:42
Is there a reason we are adding this to the NATIVE
| |
156 | 207 |
157 #define NATIVE_CONTEXT_FIELDS(V) \ | 208 #define NATIVE_CONTEXT_FIELDS(V) \ |
158 V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \ | 209 V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \ |
159 V(EMBEDDER_DATA_INDEX, FixedArray, embedder_data) \ | 210 V(EMBEDDER_DATA_INDEX, FixedArray, embedder_data) \ |
160 /* Below is alpha-sorted */ \ | 211 /* Below is alpha-sorted */ \ |
161 V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \ | 212 V(ALLOW_CODE_GEN_FROM_STRINGS_INDEX, Object, allow_code_gen_from_strings) \ |
162 V(ARRAY_BUFFER_FUN_INDEX, JSFunction, array_buffer_fun) \ | 213 V(ARRAY_BUFFER_FUN_INDEX, JSFunction, array_buffer_fun) \ |
163 V(ARRAY_BUFFER_MAP_INDEX, Map, array_buffer_map) \ | 214 V(ARRAY_BUFFER_MAP_INDEX, Map, array_buffer_map) \ |
164 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \ | 215 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \ |
165 V(BOOL16X8_FUNCTION_INDEX, JSFunction, bool16x8_function) \ | 216 V(BOOL16X8_FUNCTION_INDEX, JSFunction, bool16x8_function) \ |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
491 void SetOptimizedCodeListHead(Object* head); | 542 void SetOptimizedCodeListHead(Object* head); |
492 Object* OptimizedCodeListHead(); | 543 Object* OptimizedCodeListHead(); |
493 void SetDeoptimizedCodeListHead(Object* head); | 544 void SetDeoptimizedCodeListHead(Object* head); |
494 Object* DeoptimizedCodeListHead(); | 545 Object* DeoptimizedCodeListHead(); |
495 | 546 |
496 Handle<Object> ErrorMessageForCodeGenerationFromStrings(); | 547 Handle<Object> ErrorMessageForCodeGenerationFromStrings(); |
497 | 548 |
498 static int ImportedFieldIndexForName(Handle<String> name); | 549 static int ImportedFieldIndexForName(Handle<String> name); |
499 static int IntrinsicIndexForName(Handle<String> name); | 550 static int IntrinsicIndexForName(Handle<String> name); |
500 | 551 |
552 static bool IsJSBuiltin(Handle<Context> native_context, | |
553 Handle<JSFunction> function); | |
554 | |
501 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \ | 555 #define NATIVE_CONTEXT_FIELD_ACCESSORS(index, type, name) \ |
502 void set_##name(type* value) { \ | 556 void set_##name(type* value) { \ |
503 DCHECK(IsNativeContext()); \ | 557 DCHECK(IsNativeContext()); \ |
504 set(index, value); \ | 558 set(index, value); \ |
505 } \ | 559 } \ |
506 bool is_##name(type* value) { \ | 560 bool is_##name(type* value) { \ |
507 DCHECK(IsNativeContext()); \ | 561 DCHECK(IsNativeContext()); \ |
508 return type::cast(get(index)) == value; \ | 562 return type::cast(get(index)) == value; \ |
509 } \ | 563 } \ |
510 type* name() { \ | 564 type* name() { \ |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
589 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); | 643 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object); |
590 #endif | 644 #endif |
591 | 645 |
592 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); | 646 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); |
593 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 647 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
594 }; | 648 }; |
595 | 649 |
596 } } // namespace v8::internal | 650 } } // namespace v8::internal |
597 | 651 |
598 #endif // V8_CONTEXTS_H_ | 652 #endif // V8_CONTEXTS_H_ |
OLD | NEW |