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

Side by Side Diff: src/contexts.h

Issue 10170030: Implement tracking and optimizations of packed arrays (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Review feedback Created 8 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « src/codegen.h ('k') | src/elements.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(SMI_JS_ARRAY_MAP_INDEX, Object, smi_js_array_map) \ 109 V(JS_ARRAY_MAPS_INDEX, Object, js_array_maps) \
110 V(DOUBLE_JS_ARRAY_MAP_INDEX, Object, double_js_array_map) \
111 V(OBJECT_JS_ARRAY_MAP_INDEX, Object, object_js_array_map) \
112 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \ 110 V(DATE_FUNCTION_INDEX, JSFunction, date_function) \
113 V(JSON_OBJECT_INDEX, JSObject, json_object) \ 111 V(JSON_OBJECT_INDEX, JSObject, json_object) \
114 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ 112 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \
115 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \ 113 V(INITIAL_OBJECT_PROTOTYPE_INDEX, JSObject, initial_object_prototype) \
116 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \ 114 V(CREATE_DATE_FUN_INDEX, JSFunction, create_date_fun) \
117 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \ 115 V(TO_NUMBER_FUN_INDEX, JSFunction, to_number_fun) \
118 V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) \ 116 V(TO_STRING_FUN_INDEX, JSFunction, to_string_fun) \
119 V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \ 117 V(TO_DETAIL_STRING_FUN_INDEX, JSFunction, to_detail_string_fun) \
120 V(TO_OBJECT_FUN_INDEX, JSFunction, to_object_fun) \ 118 V(TO_OBJECT_FUN_INDEX, JSFunction, to_object_fun) \
121 V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \ 119 V(TO_INTEGER_FUN_INDEX, JSFunction, to_integer_fun) \
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 FUNCTION_INSTANCE_MAP_INDEX, 239 FUNCTION_INSTANCE_MAP_INDEX,
242 STRICT_MODE_FUNCTION_INSTANCE_MAP_INDEX, 240 STRICT_MODE_FUNCTION_INSTANCE_MAP_INDEX,
243 INITIAL_OBJECT_PROTOTYPE_INDEX, 241 INITIAL_OBJECT_PROTOTYPE_INDEX,
244 BOOLEAN_FUNCTION_INDEX, 242 BOOLEAN_FUNCTION_INDEX,
245 NUMBER_FUNCTION_INDEX, 243 NUMBER_FUNCTION_INDEX,
246 STRING_FUNCTION_INDEX, 244 STRING_FUNCTION_INDEX,
247 STRING_FUNCTION_PROTOTYPE_MAP_INDEX, 245 STRING_FUNCTION_PROTOTYPE_MAP_INDEX,
248 OBJECT_FUNCTION_INDEX, 246 OBJECT_FUNCTION_INDEX,
249 INTERNAL_ARRAY_FUNCTION_INDEX, 247 INTERNAL_ARRAY_FUNCTION_INDEX,
250 ARRAY_FUNCTION_INDEX, 248 ARRAY_FUNCTION_INDEX,
251 SMI_JS_ARRAY_MAP_INDEX, 249 JS_ARRAY_MAPS_INDEX,
252 DOUBLE_JS_ARRAY_MAP_INDEX,
253 OBJECT_JS_ARRAY_MAP_INDEX,
254 DATE_FUNCTION_INDEX, 250 DATE_FUNCTION_INDEX,
255 JSON_OBJECT_INDEX, 251 JSON_OBJECT_INDEX,
256 REGEXP_FUNCTION_INDEX, 252 REGEXP_FUNCTION_INDEX,
257 CREATE_DATE_FUN_INDEX, 253 CREATE_DATE_FUN_INDEX,
258 TO_NUMBER_FUN_INDEX, 254 TO_NUMBER_FUN_INDEX,
259 TO_STRING_FUN_INDEX, 255 TO_STRING_FUN_INDEX,
260 TO_DETAIL_STRING_FUN_INDEX, 256 TO_DETAIL_STRING_FUN_INDEX,
261 TO_OBJECT_FUN_INDEX, 257 TO_OBJECT_FUN_INDEX,
262 TO_INTEGER_FUN_INDEX, 258 TO_INTEGER_FUN_INDEX,
263 TO_UINT32_FUN_INDEX, 259 TO_UINT32_FUN_INDEX,
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
366 362
367 // Mark the global context with out of memory. 363 // Mark the global context with out of memory.
368 inline void mark_out_of_memory(); 364 inline void mark_out_of_memory();
369 365
370 // A global context hold a list of all functions which have been optimized. 366 // A global context hold a list of all functions which have been optimized.
371 void AddOptimizedFunction(JSFunction* function); 367 void AddOptimizedFunction(JSFunction* function);
372 void RemoveOptimizedFunction(JSFunction* function); 368 void RemoveOptimizedFunction(JSFunction* function);
373 Object* OptimizedFunctionsListHead(); 369 Object* OptimizedFunctionsListHead();
374 void ClearOptimizedFunctions(); 370 void ClearOptimizedFunctions();
375 371
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
388 #define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \ 372 #define GLOBAL_CONTEXT_FIELD_ACCESSORS(index, type, name) \
389 void set_##name(type* value) { \ 373 void set_##name(type* value) { \
390 ASSERT(IsGlobalContext()); \ 374 ASSERT(IsGlobalContext()); \
391 set(index, value); \ 375 set(index, value); \
392 } \ 376 } \
393 type* name() { \ 377 type* name() { \
394 ASSERT(IsGlobalContext()); \ 378 ASSERT(IsGlobalContext()); \
395 return type::cast(get(index)); \ 379 return type::cast(get(index)); \
396 } 380 }
397 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSORS) 381 GLOBAL_CONTEXT_FIELDS(GLOBAL_CONTEXT_FIELD_ACCESSORS)
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 #ifdef DEBUG 427 #ifdef DEBUG
444 // Bootstrapping-aware type checks. 428 // Bootstrapping-aware type checks.
445 static bool IsBootstrappingOrContext(Object* object); 429 static bool IsBootstrappingOrContext(Object* object);
446 static bool IsBootstrappingOrGlobalObject(Object* object); 430 static bool IsBootstrappingOrGlobalObject(Object* object);
447 #endif 431 #endif
448 }; 432 };
449 433
450 } } // namespace v8::internal 434 } } // namespace v8::internal
451 435
452 #endif // V8_CONTEXTS_H_ 436 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/codegen.h ('k') | src/elements.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698