| 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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 344 | 344 |
| 345 // The builtins object. | 345 // The builtins object. |
| 346 JSBuiltinsObject* builtins(); | 346 JSBuiltinsObject* builtins(); |
| 347 | 347 |
| 348 // Get the innermost global context by traversing the context chain. | 348 // Get the innermost global context by traversing the context chain. |
| 349 Context* global_context(); | 349 Context* global_context(); |
| 350 | 350 |
| 351 // Compute the native context by traversing the context chain. | 351 // Compute the native context by traversing the context chain. |
| 352 Context* native_context(); | 352 Context* native_context(); |
| 353 | 353 |
| 354 // Predicates for context types. IsNativeContext is defined on Object | 354 // Predicates for context types. IsNativeContext is also defined on Object |
| 355 // because we frequently have to know if arbitrary objects are natives | 355 // because we frequently have to know if arbitrary objects are natives |
| 356 // contexts. | 356 // contexts. |
| 357 bool IsNativeContext() { |
| 358 Map* map = this->map(); |
| 359 return map == map->GetHeap()->native_context_map(); |
| 360 } |
| 357 bool IsFunctionContext() { | 361 bool IsFunctionContext() { |
| 358 Map* map = this->map(); | 362 Map* map = this->map(); |
| 359 return map == map->GetHeap()->function_context_map(); | 363 return map == map->GetHeap()->function_context_map(); |
| 360 } | 364 } |
| 361 bool IsCatchContext() { | 365 bool IsCatchContext() { |
| 362 Map* map = this->map(); | 366 Map* map = this->map(); |
| 363 return map == map->GetHeap()->catch_context_map(); | 367 return map == map->GetHeap()->catch_context_map(); |
| 364 } | 368 } |
| 365 bool IsWithContext() { | 369 bool IsWithContext() { |
| 366 Map* map = this->map(); | 370 Map* map = this->map(); |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 454 static bool IsBootstrappingOrGlobalObject(Object* object); | 458 static bool IsBootstrappingOrGlobalObject(Object* object); |
| 455 #endif | 459 #endif |
| 456 | 460 |
| 457 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); | 461 STATIC_CHECK(kHeaderSize == Internals::kContextHeaderSize); |
| 458 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); | 462 STATIC_CHECK(EMBEDDER_DATA_INDEX == Internals::kContextEmbedderDataIndex); |
| 459 }; | 463 }; |
| 460 | 464 |
| 461 } } // namespace v8::internal | 465 } } // namespace v8::internal |
| 462 | 466 |
| 463 #endif // V8_CONTEXTS_H_ | 467 #endif // V8_CONTEXTS_H_ |
| OLD | NEW |