| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 class FunctionInfoListener; | 70 class FunctionInfoListener; |
| 71 class HandleScopeImplementer; | 71 class HandleScopeImplementer; |
| 72 class HeapProfiler; | 72 class HeapProfiler; |
| 73 class HStatistics; | 73 class HStatistics; |
| 74 class HTracer; | 74 class HTracer; |
| 75 class InlineRuntimeFunctionsTable; | 75 class InlineRuntimeFunctionsTable; |
| 76 class NoAllocationStringAllocator; | 76 class NoAllocationStringAllocator; |
| 77 class InnerPointerToCodeCache; | 77 class InnerPointerToCodeCache; |
| 78 class MarkingThread; | 78 class MarkingThread; |
| 79 class PreallocatedMemoryThread; | 79 class PreallocatedMemoryThread; |
| 80 class RandomNumberGenerator; |
| 80 class RegExpStack; | 81 class RegExpStack; |
| 81 class SaveContext; | 82 class SaveContext; |
| 82 class UnicodeCache; | 83 class UnicodeCache; |
| 83 class ConsStringIteratorOp; | 84 class ConsStringIteratorOp; |
| 84 class StringTracker; | 85 class StringTracker; |
| 85 class StubCache; | 86 class StubCache; |
| 86 class SweeperThread; | 87 class SweeperThread; |
| 87 class ThreadManager; | 88 class ThreadManager; |
| 88 class ThreadState; | 89 class ThreadState; |
| 89 class ThreadVisitor; // Defined in v8threads.h | 90 class ThreadVisitor; // Defined in v8threads.h |
| (...skipping 1033 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1123 HStatistics* GetHStatistics(); | 1124 HStatistics* GetHStatistics(); |
| 1124 HTracer* GetHTracer(); | 1125 HTracer* GetHTracer(); |
| 1125 | 1126 |
| 1126 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } | 1127 FunctionEntryHook function_entry_hook() { return function_entry_hook_; } |
| 1127 void set_function_entry_hook(FunctionEntryHook function_entry_hook) { | 1128 void set_function_entry_hook(FunctionEntryHook function_entry_hook) { |
| 1128 function_entry_hook_ = function_entry_hook; | 1129 function_entry_hook_ = function_entry_hook; |
| 1129 } | 1130 } |
| 1130 | 1131 |
| 1131 void* stress_deopt_count_address() { return &stress_deopt_count_; } | 1132 void* stress_deopt_count_address() { return &stress_deopt_count_; } |
| 1132 | 1133 |
| 1134 inline RandomNumberGenerator* random_number_generator(); |
| 1135 |
| 1133 // Given an address occupied by a live code object, return that object. | 1136 // Given an address occupied by a live code object, return that object. |
| 1134 Object* FindCodeObject(Address a); | 1137 Object* FindCodeObject(Address a); |
| 1135 | 1138 |
| 1139 bool is_memory_constrained() const { |
| 1140 return is_memory_constrained_; |
| 1141 } |
| 1142 void set_is_memory_constrained(bool value) { |
| 1143 is_memory_constrained_ = value; |
| 1144 } |
| 1145 |
| 1136 private: | 1146 private: |
| 1137 Isolate(); | 1147 Isolate(); |
| 1138 | 1148 |
| 1139 friend struct GlobalState; | 1149 friend struct GlobalState; |
| 1140 friend struct InitializeGlobalState; | 1150 friend struct InitializeGlobalState; |
| 1141 | 1151 |
| 1142 enum State { | 1152 enum State { |
| 1143 UNINITIALIZED, // Some components may not have been allocated. | 1153 UNINITIALIZED, // Some components may not have been allocated. |
| 1144 INITIALIZED // All components are fully initialized. | 1154 INITIALIZED // All components are fully initialized. |
| 1145 }; | 1155 }; |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1297 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; | 1307 unibrow::Mapping<unibrow::CanonicalizationRange> jsregexp_canonrange_; |
| 1298 ConsStringIteratorOp objects_string_compare_iterator_a_; | 1308 ConsStringIteratorOp objects_string_compare_iterator_a_; |
| 1299 ConsStringIteratorOp objects_string_compare_iterator_b_; | 1309 ConsStringIteratorOp objects_string_compare_iterator_b_; |
| 1300 StaticResource<ConsStringIteratorOp> objects_string_iterator_; | 1310 StaticResource<ConsStringIteratorOp> objects_string_iterator_; |
| 1301 unibrow::Mapping<unibrow::Ecma262Canonicalize> | 1311 unibrow::Mapping<unibrow::Ecma262Canonicalize> |
| 1302 regexp_macro_assembler_canonicalize_; | 1312 regexp_macro_assembler_canonicalize_; |
| 1303 RegExpStack* regexp_stack_; | 1313 RegExpStack* regexp_stack_; |
| 1304 DateCache* date_cache_; | 1314 DateCache* date_cache_; |
| 1305 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; | 1315 unibrow::Mapping<unibrow::Ecma262Canonicalize> interp_canonicalize_mapping_; |
| 1306 CodeStubInterfaceDescriptor* code_stub_interface_descriptors_; | 1316 CodeStubInterfaceDescriptor* code_stub_interface_descriptors_; |
| 1317 RandomNumberGenerator* random_number_generator_; |
| 1318 bool is_memory_constrained_; |
| 1307 | 1319 |
| 1308 // True if fatal error has been signaled for this isolate. | 1320 // True if fatal error has been signaled for this isolate. |
| 1309 bool has_fatal_error_; | 1321 bool has_fatal_error_; |
| 1310 | 1322 |
| 1311 // True if we are using the Crankshaft optimizing compiler. | 1323 // True if we are using the Crankshaft optimizing compiler. |
| 1312 bool use_crankshaft_; | 1324 bool use_crankshaft_; |
| 1313 | 1325 |
| 1314 // True if this isolate was initialized from a snapshot. | 1326 // True if this isolate was initialized from a snapshot. |
| 1315 bool initialized_from_snapshot_; | 1327 bool initialized_from_snapshot_; |
| 1316 | 1328 |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1413 Isolate* isolate_; | 1425 Isolate* isolate_; |
| 1414 Handle<Context> context_; | 1426 Handle<Context> context_; |
| 1415 SaveContext* prev_; | 1427 SaveContext* prev_; |
| 1416 Address c_entry_fp_; | 1428 Address c_entry_fp_; |
| 1417 }; | 1429 }; |
| 1418 | 1430 |
| 1419 | 1431 |
| 1420 class AssertNoContextChange BASE_EMBEDDED { | 1432 class AssertNoContextChange BASE_EMBEDDED { |
| 1421 #ifdef DEBUG | 1433 #ifdef DEBUG |
| 1422 public: | 1434 public: |
| 1423 AssertNoContextChange() : context_(Isolate::Current()->context()) { } | 1435 AssertNoContextChange() |
| 1436 : isolate_(Isolate::Current()), |
| 1437 context_(isolate_->context()) { } |
| 1424 ~AssertNoContextChange() { | 1438 ~AssertNoContextChange() { |
| 1425 ASSERT(Isolate::Current()->context() == *context_); | 1439 ASSERT(isolate_->context() == *context_); |
| 1426 } | 1440 } |
| 1427 | 1441 |
| 1428 private: | 1442 private: |
| 1443 Isolate* isolate_; |
| 1429 Handle<Context> context_; | 1444 Handle<Context> context_; |
| 1430 #else | 1445 #else |
| 1431 public: | 1446 public: |
| 1432 AssertNoContextChange() { } | 1447 AssertNoContextChange() { } |
| 1433 #endif | 1448 #endif |
| 1434 }; | 1449 }; |
| 1435 | 1450 |
| 1436 | 1451 |
| 1437 // TODO(mstarzinger): Depracate as soon as everything is handlified. | 1452 // TODO(mstarzinger): Depracate as soon as everything is handlified. |
| 1438 class AssertNoContextChangeWithHandleScope BASE_EMBEDDED { | 1453 class AssertNoContextChangeWithHandleScope BASE_EMBEDDED { |
| 1439 #ifdef DEBUG | 1454 #ifdef DEBUG |
| 1440 public: | 1455 public: |
| 1441 AssertNoContextChangeWithHandleScope() : | 1456 AssertNoContextChangeWithHandleScope() : |
| 1442 scope_(Isolate::Current()), | 1457 isolate_(Isolate::Current()), |
| 1443 context_(Isolate::Current()->context(), Isolate::Current()) { | 1458 scope_(isolate_), |
| 1459 context_(isolate_->context(), isolate_) { |
| 1444 } | 1460 } |
| 1445 | 1461 |
| 1446 ~AssertNoContextChangeWithHandleScope() { | 1462 ~AssertNoContextChangeWithHandleScope() { |
| 1447 ASSERT(Isolate::Current()->context() == *context_); | 1463 ASSERT(isolate_->context() == *context_); |
| 1448 } | 1464 } |
| 1449 | 1465 |
| 1450 private: | 1466 private: |
| 1467 Isolate* isolate_; |
| 1451 HandleScope scope_; | 1468 HandleScope scope_; |
| 1452 Handle<Context> context_; | 1469 Handle<Context> context_; |
| 1453 #else | 1470 #else |
| 1454 public: | 1471 public: |
| 1455 AssertNoContextChangeWithHandleScope() { } | 1472 AssertNoContextChangeWithHandleScope() { } |
| 1456 #endif | 1473 #endif |
| 1457 }; | 1474 }; |
| 1458 | 1475 |
| 1459 | 1476 |
| 1460 class ExecutionAccess BASE_EMBEDDED { | 1477 class ExecutionAccess BASE_EMBEDDED { |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1505 ~PostponeInterruptsScope() { | 1522 ~PostponeInterruptsScope() { |
| 1506 if (--stack_guard_->thread_local_.postpone_interrupts_nesting_ == 0) { | 1523 if (--stack_guard_->thread_local_.postpone_interrupts_nesting_ == 0) { |
| 1507 stack_guard_->EnableInterrupts(); | 1524 stack_guard_->EnableInterrupts(); |
| 1508 } | 1525 } |
| 1509 } | 1526 } |
| 1510 private: | 1527 private: |
| 1511 StackGuard* stack_guard_; | 1528 StackGuard* stack_guard_; |
| 1512 }; | 1529 }; |
| 1513 | 1530 |
| 1514 | 1531 |
| 1515 // Temporary macros for accessing current isolate and its subobjects. | |
| 1516 // They provide better readability, especially when used a lot in the code. | |
| 1517 #define HEAP (v8::internal::Isolate::Current()->heap()) | |
| 1518 #define ISOLATE (v8::internal::Isolate::Current()) | |
| 1519 | |
| 1520 | |
| 1521 // Tells whether the native context is marked with out of memory. | 1532 // Tells whether the native context is marked with out of memory. |
| 1522 inline bool Context::has_out_of_memory() { | 1533 inline bool Context::has_out_of_memory() { |
| 1523 return native_context()->out_of_memory()->IsTrue(); | 1534 return native_context()->out_of_memory()->IsTrue(); |
| 1524 } | 1535 } |
| 1525 | 1536 |
| 1526 | 1537 |
| 1527 // Mark the native context with out of memory. | 1538 // Mark the native context with out of memory. |
| 1528 inline void Context::mark_out_of_memory() { | 1539 inline void Context::mark_out_of_memory() { |
| 1529 native_context()->set_out_of_memory(HEAP->true_value()); | 1540 native_context()->set_out_of_memory(GetIsolate()->heap()->true_value()); |
| 1530 } | 1541 } |
| 1531 | 1542 |
| 1532 | 1543 |
| 1533 } } // namespace v8::internal | 1544 } } // namespace v8::internal |
| 1534 | 1545 |
| 1535 #endif // V8_ISOLATE_H_ | 1546 #endif // V8_ISOLATE_H_ |
| OLD | NEW |