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

Side by Side Diff: src/contexts.h

Issue 1478303002: Revert of [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: 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) \
226 V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \ 227 V(SCRIPT_CONTEXT_TABLE_INDEX, ScriptContextTable, script_context_table) \
227 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \ 228 V(SCRIPT_FUNCTION_INDEX, JSFunction, script_function) \
228 V(SECURITY_TOKEN_INDEX, Object, security_token) \ 229 V(SECURITY_TOKEN_INDEX, Object, security_token) \
229 V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \ 230 V(SET_ITERATOR_MAP_INDEX, Map, set_iterator_map) \
230 V(SHARED_ARRAY_BUFFER_FUN_INDEX, JSFunction, shared_array_buffer_fun) \ 231 V(SHARED_ARRAY_BUFFER_FUN_INDEX, JSFunction, shared_array_buffer_fun) \
231 V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \ 232 V(SLOPPY_ARGUMENTS_MAP_INDEX, Map, sloppy_arguments_map) \
232 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \ 233 V(SLOPPY_FUNCTION_MAP_INDEX, Map, sloppy_function_map) \
233 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \ 234 V(SLOPPY_FUNCTION_WITHOUT_PROTOTYPE_MAP_INDEX, Map, \
234 sloppy_function_without_prototype_map) \ 235 sloppy_function_without_prototype_map) \
235 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \ 236 V(SLOPPY_FUNCTION_WITH_READONLY_PROTOTYPE_MAP_INDEX, Map, \
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
360 class Context: public FixedArray { 361 class Context: public FixedArray {
361 public: 362 public:
362 // Conversions. 363 // Conversions.
363 static inline Context* cast(Object* context); 364 static inline Context* cast(Object* context);
364 365
365 // The default context slot layout; indices are FixedArray slot indices. 366 // The default context slot layout; indices are FixedArray slot indices.
366 enum { 367 enum {
367 // These slots are in all contexts. 368 // These slots are in all contexts.
368 CLOSURE_INDEX, 369 CLOSURE_INDEX,
369 PREVIOUS_INDEX, 370 PREVIOUS_INDEX,
370 // The extension slot is used for either the global object (in native 371 // The extension slot is used for either the global object (in global
371 // contexts), eval extension object (function contexts), subject of with 372 // contexts), eval extension object (function contexts), subject of with
372 // (with contexts), or the variable name (catch contexts), the serialized 373 // (with contexts), or the variable name (catch contexts), the serialized
373 // scope info (block contexts), or the module instance (module contexts). 374 // scope info (block contexts), or the module instance (module contexts).
374 EXTENSION_INDEX, 375 EXTENSION_INDEX,
375 NATIVE_CONTEXT_INDEX, 376 GLOBAL_OBJECT_INDEX,
376 377
377 // These slots are only in native contexts. 378 // These slots are only in native contexts.
378 #define NATIVE_CONTEXT_SLOT(index, type, name) index, 379 #define NATIVE_CONTEXT_SLOT(index, type, name) index,
379 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_SLOT) 380 NATIVE_CONTEXT_FIELDS(NATIVE_CONTEXT_SLOT)
380 #undef NATIVE_CONTEXT_SLOT 381 #undef NATIVE_CONTEXT_SLOT
381 382
382 // Properties from here are treated as weak references by the full GC. 383 // Properties from here are treated as weak references by the full GC.
383 // Scavenge treats them as strong references. 384 // Scavenge treats them as strong references.
384 OPTIMIZED_FUNCTIONS_LIST, // Weak. 385 OPTIMIZED_FUNCTIONS_LIST, // Weak.
385 OPTIMIZED_CODE_LIST, // Weak. 386 OPTIMIZED_CODE_LIST, // Weak.
(...skipping 28 matching lines...) Expand all
414 String* catch_name(); 415 String* catch_name();
415 416
416 inline JSModule* module(); 417 inline JSModule* module();
417 inline void set_module(JSModule* module); 418 inline void set_module(JSModule* module);
418 419
419 // Get the context where var declarations will be hoisted to, which 420 // Get the context where var declarations will be hoisted to, which
420 // may be the context itself. 421 // may be the context itself.
421 Context* declaration_context(); 422 Context* declaration_context();
422 bool is_declaration_context(); 423 bool is_declaration_context();
423 424
425 inline JSGlobalObject* global_object();
426 inline void set_global_object(JSGlobalObject* object);
427
424 // Returns a JSGlobalProxy object or null. 428 // Returns a JSGlobalProxy object or null.
425 JSObject* global_proxy(); 429 JSObject* global_proxy();
426 void set_global_proxy(JSObject* global); 430 void set_global_proxy(JSObject* global);
427 431
428 // Get the JSGlobalObject object.
429 JSGlobalObject* global_object();
430
431 // Get the script context by traversing the context chain. 432 // Get the script context by traversing the context chain.
432 Context* script_context(); 433 Context* script_context();
433 434
434 // Compute the native context. 435 // Compute the native context by traversing the context chain.
435 inline Context* native_context(); 436 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);
552 static bool IsBootstrappingOrValidParentContext(Object* object, Context* kid); 551 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