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

Side by Side Diff: src/contexts.h

Issue 1480003002: [runtime] Replace global object link with native context link in all contexts. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Add patch from Orion for interpreter cementation test. Disable obsolete/invalid tests. Created 5 years 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
« no previous file with comments | « src/compiler/verifier.cc ('k') | src/contexts.cc » ('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 // 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 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
216 V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \ 216 V(MESSAGE_LISTENERS_INDEX, JSObject, message_listeners) \
217 V(NATIVES_UTILS_OBJECT_INDEX, Object, natives_utils_object) \ 217 V(NATIVES_UTILS_OBJECT_INDEX, Object, natives_utils_object) \
218 V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \ 218 V(NORMALIZED_MAP_CACHE_INDEX, Object, normalized_map_cache) \
219 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \ 219 V(NUMBER_FUNCTION_INDEX, JSFunction, number_function) \
220 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \ 220 V(OBJECT_FUNCTION_INDEX, JSFunction, object_function) \
221 V(OBJECT_FUNCTION_PROTOTYPE_MAP_INDEX, Map, object_function_prototype_map) \ 221 V(OBJECT_FUNCTION_PROTOTYPE_MAP_INDEX, Map, object_function_prototype_map) \
222 V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \ 222 V(OPAQUE_REFERENCE_FUNCTION_INDEX, JSFunction, opaque_reference_function) \
223 V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function) \ 223 V(PROXY_FUNCTION_INDEX, JSFunction, proxy_function) \
224 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \ 224 V(REGEXP_FUNCTION_INDEX, JSFunction, regexp_function) \
225 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map) \ 225 V(REGEXP_RESULT_MAP_INDEX, Map, regexp_result_map) \
226 V(RUNTIME_CONTEXT_INDEX, Context, runtime_context) \
227 V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \ 226 V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \
228 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \ 227 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \
229 V(SECURITY_TOKEN_INDEX, Object, security_token) \ 228 V(SECURITY_TOKEN_INDEX, Object, security_token) \
230 V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \ 229 V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \
231 V(SHARED_ARRAY_BUFFER_FUN_INDEX, JSFunction, shared_array_buffer_fun) \ 230 V(SHARED_ARRAY_BUFFER_FUN_INDEX, JSFunction, shared_array_buffer_fun) \
232 V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \ 231 V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \
233 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \ 232 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \
234 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ 233 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
235 sloppy_function_without_prototype_map) \ 234 sloppy_function_without_prototype_map) \
236 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \ 235 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 class Context: public FixedArray { 360 class Context: public FixedArray {
362 public: 361 public:
363 // Conversions. 362 // Conversions.
364 static inline Context* cast(Object* context); 363 static inline Context* cast(Object* context);
365 364
366 // The default context slot layout; indices are FixedArray slot indices. 365 // The default context slot layout; indices are FixedArray slot indices.
367 enum { 366 enum {
368 // These slots are in all contexts. 367 // These slots are in all contexts.
369 CLOSURE_INDEX, 368 CLOSURE_INDEX,
370 PREVIOUS_INDEX, 369 PREVIOUS_INDEX,
371 // The extension slot is used for either the global object (in global 370 // The extension slot is used for either the global object (in native
372 // contexts), eval extension object (function contexts), subject of with 371 // contexts), eval extension object (function contexts), subject of with
373 // (with contexts), or the variable name (catch contexts), the serialized 372 // (with contexts), or the variable name (catch contexts), the serialized
374 // scope info (block contexts), or the module instance (module contexts). 373 // scope info (block contexts), or the module instance (module contexts).
375 EXTENSION_INDEX, 374 EXTENSION_INDEX,
376 GLOBAL_OBJECT_INDEX, 375 NATIVE_CONTEXT_INDEX,
377 376
378 // These slots are only in native contexts. 377 // These slots are only in native contexts.
379 #define NATIVE_CONTEXT_SLOT(index, type, name) index, 378 #define NATIVE_CONTEXT_SLOT(index, type, name) index,
380 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_SLOT) 379 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_SLOT)
381 #undef NATIVE_CONTEXT_SLOT 380 #undef NATIVE_CONTEXT_SLOT
382 381
383 // Properties from here are treated as weak references by the full GC. 382 // Properties from here are treated as weak references by the full GC.
384 // Scavenge treats them as strong references. 383 // Scavenge treats them as strong references.
385 OPTIMIZED_FUNCTIONS_LIST, // Weak. 384 OPTIMIZED_FUNCTIONS_LIST, // Weak.
386 OPTIMIZED_CODE_LIST, // Weak. 385 OPTIMIZED_CODE_LIST, // Weak.
(...skipping 28 matching lines...) Expand all
415 String* catch_name(); 414 String* catch_name();
416 415
417 inline JSModule* module(); 416 inline JSModule* module();
418 inline void set_module(JSModule* module); 417 inline void set_module(JSModule* module);
419 418
420 // Get the context where var declarations will be hoisted to, which 419 // Get the context where var declarations will be hoisted to, which
421 // may be the context itself. 420 // may be the context itself.
422 Context* declaration_context(); 421 Context* declaration_context();
423 bool is_declaration_context(); 422 bool is_declaration_context();
424 423
425 inline JSGlobalObject* global_object();
426 inline void set_global_object(JSGlobalObject* object);
427
428 // Returns a JSGlobalProxy object or null. 424 // Returns a JSGlobalProxy object or null.
429 JSObject* global_proxy(); 425 JSObject* global_proxy();
430 void set_global_proxy(JSObject* global); 426 void set_global_proxy(JSObject* global);
431 427
428 // Get the JSGlobalObject object.
429 JSGlobalObject* global_object();
430
432 // Get the script context by traversing the context chain. 431 // Get the script context by traversing the context chain.
433 Context* script_context(); 432 Context* script_context();
434 433
435 // Compute the native context by traversing the context chain. 434 // Compute the native context.
436 Context* native_context(); 435 inline Context* native_context();
436 inline void set_native_context(Context* context);
437 437
438 // Predicates for context types. IsNativeContext is also defined on Object 438 // Predicates for context types. IsNativeContext is also defined on Object
439 // because we frequently have to know if arbitrary objects are natives 439 // because we frequently have to know if arbitrary objects are natives
440 // contexts. 440 // contexts.
441 inline bool IsNativeContext(); 441 inline bool IsNativeContext();
442 inline bool IsFunctionContext(); 442 inline bool IsFunctionContext();
443 inline bool IsCatchContext(); 443 inline bool IsCatchContext();
444 inline bool IsWithContext(); 444 inline bool IsWithContext();
445 inline bool IsBlockContext(); 445 inline bool IsBlockContext();
446 inline bool IsModuleContext(); 446 inline bool IsModuleContext();
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
541 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor; 541 kHeaderSize, kSize, kSize> ScavengeBodyDescriptor;
542 542
543 typedef FixedBodyDescriptor< 543 typedef FixedBodyDescriptor<
544 kHeaderSize, 544 kHeaderSize,
545 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize, 545 kHeaderSize + FIRST_WEAK_SLOT * kPointerSize,
546 kSize> MarkCompactBodyDescriptor; 546 kSize> MarkCompactBodyDescriptor;
547 547
548 private: 548 private:
549 #ifdef DEBUG 549 #ifdef DEBUG
550 // Bootstrapping-aware type checks. 550 // Bootstrapping-aware type checks.
551 static bool IsBootstrappingOrNativeContext(Isolate* isolate, Object* object);
551 static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid); 552 static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid);
552 static bool IsBootstrappingOrGlobalObject(Isolate* isolate, Object* object);
553 #endif 553 #endif
554 554
555 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize); 555 STATIC_ASSERT(kHeaderSize == Internals::kContextHeaderSize);
556 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); 556 STATIC_ASSERT(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex);
557 }; 557 };
558 558
559 } // namespace internal 559 } // namespace internal
560 } // namespace v8 560 } // namespace v8
561 561
562 #endif // V8_CONTEXTS_H_ 562 #endif // V8_CONTEXTS_H_
OLDNEW
« no previous file with comments | « src/compiler/verifier.cc ('k') | src/contexts.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698