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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
99 #define GLOBAL_CONTEXT_FIELDS(V) \ | 99 #define GLOBAL_CONTEXT_FIELDS(V) \ |
100 V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \ | 100 V(GLOBAL_PROXY_INDEX, JSObject, global_proxy_object) \ |
101 V(SECURITY_TOKEN_INDEX, Object, security_token) \ | 101 V(SECURITY_TOKEN_INDEX, Object, security_token) \ |
102 V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \ | 102 V(BOOLEAN_FUNCTION_INDEX, JSFunction, boolean_function) \ |
103 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ | 103 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ |
104 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ | 104 V(STRING_FUNCTION_INDEX, JSFunction, string_function) \ |
105 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ | 105 V(STRING_FUNCTION_PROTOTYPE_MAP_INDEX, Map, string_function_prototype_map) \ |
106 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ | 106 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ |
107 V(INTERNAL_ARRAY_FUNCTION_INDEX, JSFunction, internal_array_function) \ | 107 V(INTERNAL_ARRAY_FUNCTION_INDEX, JSFunction, internal_array_function) \ |
108 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \ | 108 V(ARRAY_FUNCTION_INDEX, JSFunction, array_function) \ |
109 V(JS_ARRAY_MAPS_INDEX, Object, js_array_maps) \ | 109 V(SMI_JS_ARRAY_MAP_INDEX, Object, smi_js_array_map) \ |
| 110 V(DOUBLE_JS_ARRAY_MAP_INDEX, Object, double_js_array_map) \ |
| 111 V(OBJECT_JS_ARRAY_MAP_INDEX, Object, object_js_array_map) \ |
110 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \ | 112 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \ |
111 V(JSON_OBJECT_INDEX, JSObject, json_object) \ | 113 V(JSON_OBJECT_INDEX, JSObject, json_object) \ |
112 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ | 114 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ |
113 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \ | 115 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \ |
114 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ | 116 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ |
115 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ | 117 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ |
116 V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) \ | 118 V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) \ |
117 V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \ | 119 V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \ |
118 V(TO_OBJECT_FUN_INDEX, JSFunction, to_object_fun) \ | 120 V(TO_OBJECT_FUN_INDEX, JSFunction, to_object_fun) \ |
119 V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \ | 121 V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \ |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
239 FUNCTION_INSTANCE_MAP_INDEX, | 241 FUNCTION_INSTANCE_MAP_INDEX, |
240 STRICT_MODE_FUNCTION_INSTANCE_MAP_INDEX, | 242 STRICT_MODE_FUNCTION_INSTANCE_MAP_INDEX, |
241 INITIAL_OBJECT_PROTOTYPE_INDEX, | 243 INITIAL_OBJECT_PROTOTYPE_INDEX, |
242 BOOLEAN_FUNCTION_INDEX, | 244 BOOLEAN_FUNCTION_INDEX, |
243 NUMBER_FUNCTION_INDEX, | 245 NUMBER_FUNCTION_INDEX, |
244 STRING_FUNCTION_INDEX, | 246 STRING_FUNCTION_INDEX, |
245 STRING_FUNCTION_PROTOTYPE_MAP_INDEX, | 247 STRING_FUNCTION_PROTOTYPE_MAP_INDEX, |
246 OBJECT_FUNCTION_INDEX, | 248 OBJECT_FUNCTION_INDEX, |
247 INTERNAL_ARRAY_FUNCTION_INDEX, | 249 INTERNAL_ARRAY_FUNCTION_INDEX, |
248 ARRAY_FUNCTION_INDEX, | 250 ARRAY_FUNCTION_INDEX, |
249 JS_ARRAY_MAPS_INDEX, | 251 SMI_JS_ARRAY_MAP_INDEX, |
| 252 DOUBLE_JS_ARRAY_MAP_INDEX, |
| 253 OBJECT_JS_ARRAY_MAP_INDEX, |
250 DATE_FUNCTION_INDEX, | 254 DATE_FUNCTION_INDEX, |
251 JSON_OBJECT_INDEX, | 255 JSON_OBJECT_INDEX, |
252 REGEXP_FUNCTION_INDEX, | 256 REGEXP_FUNCTION_INDEX, |
253 CREATE_DATE_FUN_INDEX, | 257 CREATE_DATE_FUN_INDEX, |
254 TO_NUMBER_FUN_INDEX, | 258 TO_NUMBER_FUN_INDEX, |
255 TO_STRING_FUN_INDEX, | 259 TO_STRING_FUN_INDEX, |
256 TO_DETAIL_STRING_FUN_INDEX, | 260 TO_DETAIL_STRING_FUN_INDEX, |
257 TO_OBJECT_FUN_INDEX, | 261 TO_OBJECT_FUN_INDEX, |
258 TO_INTEGER_FUN_INDEX, | 262 TO_INTEGER_FUN_INDEX, |
259 TO_UINT32_FUN_INDEX, | 263 TO_UINT32_FUN_INDEX, |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 | 366 |
363 // Mark the global context with out of memory. | 367 // Mark the global context with out of memory. |
364 inline void mark_out_of_memory(); | 368 inline void mark_out_of_memory(); |
365 | 369 |
366 // A global context hold a list of all functions which have been optimized. | 370 // A global context hold a list of all functions which have been optimized. |
367 void AddOptimizedFunction(JSFunction* function); | 371 void AddOptimizedFunction(JSFunction* function); |
368 void RemoveOptimizedFunction(JSFunction* function); | 372 void RemoveOptimizedFunction(JSFunction* function); |
369 Object* OptimizedFunctionsListHead(); | 373 Object* OptimizedFunctionsListHead(); |
370 void ClearOptimizedFunctions(); | 374 void ClearOptimizedFunctions(); |
371 | 375 |
| 376 static int GetContextMapIndexFromElementsKind( |
| 377 ElementsKind elements_kind) { |
| 378 if (elements_kind == FAST_DOUBLE_ELEMENTS) { |
| 379 return Context::DOUBLE_JS_ARRAY_MAP_INDEX; |
| 380 } else if (elements_kind == FAST_ELEMENTS) { |
| 381 return Context::OBJECT_JS_ARRAY_MAP_INDEX; |
| 382 } else { |
| 383 ASSERT(elements_kind == FAST_SMI_ONLY_ELEMENTS); |
| 384 return Context::SMI_JS_ARRAY_MAP_INDEX; |
| 385 } |
| 386 } |
| 387 |
372 #define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \ | 388 #define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \ |
373 void set_##name(type* value) { \ | 389 void set_##name(type* value) { \ |
374 ASSERT(IsGlobalContext()); \ | 390 ASSERT(IsGlobalContext()); \ |
375 set(index, value); \ | 391 set(index, value); \ |
376 } \ | 392 } \ |
377 type* name() { \ | 393 type* name() { \ |
378 ASSERT(IsGlobalContext()); \ | 394 ASSERT(IsGlobalContext()); \ |
379 return type::cast(get(index)); \ | 395 return type::cast(get(index)); \ |
380 } | 396 } |
381 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSORS) | 397 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSORS) |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
427 #ifdef DEBUG | 443 #ifdef DEBUG |
428 // Bootstrapping-aware type checks. | 444 // Bootstrapping-aware type checks. |
429 static bool IsBootstrappingOrContext(Object* object); | 445 static bool IsBootstrappingOrContext(Object* object); |
430 static bool IsBootstrappingOrGlobalObject(Object* object); | 446 static bool IsBootstrappingOrGlobalObject(Object* object); |
431 #endif | 447 #endif |
432 }; | 448 }; |
433 | 449 |
434 } } // namespace v8::internal | 450 } } // namespace v8::internal |
435 | 451 |
436 #endif // V8_CONTEXTS_H_ | 452 #endif // V8_CONTEXTS_H_ |
OLD | NEW |