| 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 653 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 664 bool encountered_strict_function = false; | 664 bool encountered_strict_function = false; |
| 665 for (StackFrameIterator iter(this); | 665 for (StackFrameIterator iter(this); |
| 666 !iter.done() && frames_seen < limit; | 666 !iter.done() && frames_seen < limit; |
| 667 iter.Advance()) { | 667 iter.Advance()) { |
| 668 StackFrame* raw_frame = iter.frame(); | 668 StackFrame* raw_frame = iter.frame(); |
| 669 if (IsVisibleInStackTrace(raw_frame, *caller, &seen_caller)) { | 669 if (IsVisibleInStackTrace(raw_frame, *caller, &seen_caller)) { |
| 670 frames_seen++; | 670 frames_seen++; |
| 671 JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame); | 671 JavaScriptFrame* frame = JavaScriptFrame::cast(raw_frame); |
| 672 // Set initial size to the maximum inlining level + 1 for the outermost | 672 // Set initial size to the maximum inlining level + 1 for the outermost |
| 673 // function. | 673 // function. |
| 674 List<FrameSummary> frames(Compiler::kMaxInliningLevels + 1); | 674 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 675 frame->Summarize(&frames); | 675 frame->Summarize(&frames); |
| 676 for (int i = frames.length() - 1; i >= 0; i--) { | 676 for (int i = frames.length() - 1; i >= 0; i--) { |
| 677 if (cursor + 4 > elements->length()) { | 677 if (cursor + 4 > elements->length()) { |
| 678 int new_capacity = JSObject::NewElementsCapacity(elements->length()); | 678 int new_capacity = JSObject::NewElementsCapacity(elements->length()); |
| 679 Handle<FixedArray> new_elements = | 679 Handle<FixedArray> new_elements = |
| 680 factory()->NewFixedArrayWithHoles(new_capacity); | 680 factory()->NewFixedArrayWithHoles(new_capacity); |
| 681 for (int i = 0; i < cursor; i++) { | 681 for (int i = 0; i < cursor; i++) { |
| 682 new_elements->set(i, elements->get(i)); | 682 new_elements->set(i, elements->get(i)); |
| 683 } | 683 } |
| 684 elements = new_elements; | 684 elements = new_elements; |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 747 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isEval")); | 747 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isEval")); |
| 748 Handle<String> constructor_key = | 748 Handle<String> constructor_key = |
| 749 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isConstructor")); | 749 factory()->InternalizeOneByteString(STATIC_ASCII_VECTOR("isConstructor")); |
| 750 | 750 |
| 751 StackTraceFrameIterator it(this); | 751 StackTraceFrameIterator it(this); |
| 752 int frames_seen = 0; | 752 int frames_seen = 0; |
| 753 while (!it.done() && (frames_seen < limit)) { | 753 while (!it.done() && (frames_seen < limit)) { |
| 754 JavaScriptFrame* frame = it.frame(); | 754 JavaScriptFrame* frame = it.frame(); |
| 755 // Set initial size to the maximum inlining level + 1 for the outermost | 755 // Set initial size to the maximum inlining level + 1 for the outermost |
| 756 // function. | 756 // function. |
| 757 List<FrameSummary> frames(Compiler::kMaxInliningLevels + 1); | 757 List<FrameSummary> frames(FLAG_max_inlining_levels + 1); |
| 758 frame->Summarize(&frames); | 758 frame->Summarize(&frames); |
| 759 for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { | 759 for (int i = frames.length() - 1; i >= 0 && frames_seen < limit; i--) { |
| 760 // Create a JSObject to hold the information for the StackFrame. | 760 // Create a JSObject to hold the information for the StackFrame. |
| 761 Handle<JSObject> stack_frame = factory()->NewJSObject(object_function()); | 761 Handle<JSObject> stack_frame = factory()->NewJSObject(object_function()); |
| 762 | 762 |
| 763 Handle<JSFunction> fun = frames[i].function(); | 763 Handle<JSFunction> fun = frames[i].function(); |
| 764 Handle<Script> script(Script::cast(fun->shared()->script())); | 764 Handle<Script> script(Script::cast(fun->shared()->script())); |
| 765 | 765 |
| 766 if (options & StackTrace::kLineNumber) { | 766 if (options & StackTrace::kLineNumber) { |
| 767 int script_line_offset = script->line_offset()->value(); | 767 int script_line_offset = script->line_offset()->value(); |
| (...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1783 code_stub_interface_descriptors_(NULL), | 1783 code_stub_interface_descriptors_(NULL), |
| 1784 context_exit_happened_(false), | 1784 context_exit_happened_(false), |
| 1785 initialized_from_snapshot_(false), | 1785 initialized_from_snapshot_(false), |
| 1786 cpu_profiler_(NULL), | 1786 cpu_profiler_(NULL), |
| 1787 heap_profiler_(NULL), | 1787 heap_profiler_(NULL), |
| 1788 function_entry_hook_(NULL), | 1788 function_entry_hook_(NULL), |
| 1789 deferred_handles_head_(NULL), | 1789 deferred_handles_head_(NULL), |
| 1790 optimizing_compiler_thread_(this), | 1790 optimizing_compiler_thread_(this), |
| 1791 marking_thread_(NULL), | 1791 marking_thread_(NULL), |
| 1792 sweeper_thread_(NULL), | 1792 sweeper_thread_(NULL), |
| 1793 callback_table_(NULL) { | 1793 callback_table_(NULL), |
| 1794 stress_deopt_count_(0) { |
| 1794 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); | 1795 id_ = NoBarrier_AtomicIncrement(&isolate_counter_, 1); |
| 1795 TRACE_ISOLATE(constructor); | 1796 TRACE_ISOLATE(constructor); |
| 1796 | 1797 |
| 1797 memset(isolate_addresses_, 0, | 1798 memset(isolate_addresses_, 0, |
| 1798 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); | 1799 sizeof(isolate_addresses_[0]) * (kIsolateAddressCount + 1)); |
| 1799 | 1800 |
| 1800 heap_.isolate_ = this; | 1801 heap_.isolate_ = this; |
| 1801 stack_guard_.isolate_ = this; | 1802 stack_guard_.isolate_ = this; |
| 1802 | 1803 |
| 1803 // ThreadManager is initialized early to support locking an isolate | 1804 // ThreadManager is initialized early to support locking an isolate |
| (...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1896 if (FLAG_marking_threads > 0) { | 1897 if (FLAG_marking_threads > 0) { |
| 1897 for (int i = 0; i < FLAG_marking_threads; i++) { | 1898 for (int i = 0; i < FLAG_marking_threads; i++) { |
| 1898 marking_thread_[i]->Stop(); | 1899 marking_thread_[i]->Stop(); |
| 1899 delete marking_thread_[i]; | 1900 delete marking_thread_[i]; |
| 1900 } | 1901 } |
| 1901 delete[] marking_thread_; | 1902 delete[] marking_thread_; |
| 1902 } | 1903 } |
| 1903 | 1904 |
| 1904 if (FLAG_hydrogen_stats) GetHStatistics()->Print(); | 1905 if (FLAG_hydrogen_stats) GetHStatistics()->Print(); |
| 1905 | 1906 |
| 1907 if (FLAG_print_deopt_stress) { |
| 1908 PrintF(stdout, "=== Stress deopt counter: %u\n", stress_deopt_count_); |
| 1909 } |
| 1910 |
| 1906 // We must stop the logger before we tear down other components. | 1911 // We must stop the logger before we tear down other components. |
| 1907 Sampler* sampler = logger_->sampler(); | 1912 Sampler* sampler = logger_->sampler(); |
| 1908 if (sampler && sampler->IsActive()) sampler->Stop(); | 1913 if (sampler && sampler->IsActive()) sampler->Stop(); |
| 1909 | 1914 |
| 1910 delete deoptimizer_data_; | 1915 delete deoptimizer_data_; |
| 1911 deoptimizer_data_ = NULL; | 1916 deoptimizer_data_ = NULL; |
| 1912 if (FLAG_preemption) { | 1917 if (FLAG_preemption) { |
| 1913 v8::Locker locker(reinterpret_cast<v8::Isolate*>(this)); | 1918 v8::Locker locker(reinterpret_cast<v8::Isolate*>(this)); |
| 1914 v8::Locker::StopPreemption(); | 1919 v8::Locker::StopPreemption(); |
| 1915 } | 1920 } |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2130 Release_Store(&debugger_initialized_, true); | 2135 Release_Store(&debugger_initialized_, true); |
| 2131 #endif | 2136 #endif |
| 2132 } | 2137 } |
| 2133 | 2138 |
| 2134 | 2139 |
| 2135 bool Isolate::Init(Deserializer* des) { | 2140 bool Isolate::Init(Deserializer* des) { |
| 2136 ASSERT(state_ != INITIALIZED); | 2141 ASSERT(state_ != INITIALIZED); |
| 2137 ASSERT(Isolate::Current() == this); | 2142 ASSERT(Isolate::Current() == this); |
| 2138 TRACE_ISOLATE(init); | 2143 TRACE_ISOLATE(init); |
| 2139 | 2144 |
| 2145 stress_deopt_count_ = FLAG_deopt_every_n_times; |
| 2146 |
| 2140 if (function_entry_hook() != NULL) { | 2147 if (function_entry_hook() != NULL) { |
| 2141 // When function entry hooking is in effect, we have to create the code | 2148 // When function entry hooking is in effect, we have to create the code |
| 2142 // stubs from scratch to get entry hooks, rather than loading the previously | 2149 // stubs from scratch to get entry hooks, rather than loading the previously |
| 2143 // generated stubs from disk. | 2150 // generated stubs from disk. |
| 2144 // If this assert fires, the initialization path has regressed. | 2151 // If this assert fires, the initialization path has regressed. |
| 2145 ASSERT(des == NULL); | 2152 ASSERT(des == NULL); |
| 2146 } | 2153 } |
| 2147 | 2154 |
| 2148 // The initialization process does not handle memory exhaustion. | 2155 // The initialization process does not handle memory exhaustion. |
| 2149 DisallowAllocationFailure disallow_allocation_failure; | 2156 DisallowAllocationFailure disallow_allocation_failure; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2501 return initial_object_proto->GetPrototype()->IsNull(); | 2508 return initial_object_proto->GetPrototype()->IsNull(); |
| 2502 } | 2509 } |
| 2503 | 2510 |
| 2504 | 2511 |
| 2505 CodeStubInterfaceDescriptor* | 2512 CodeStubInterfaceDescriptor* |
| 2506 Isolate::code_stub_interface_descriptor(int index) { | 2513 Isolate::code_stub_interface_descriptor(int index) { |
| 2507 return code_stub_interface_descriptors_ + index; | 2514 return code_stub_interface_descriptors_ + index; |
| 2508 } | 2515 } |
| 2509 | 2516 |
| 2510 | 2517 |
| 2518 Object* Isolate::FindCodeObject(Address a) { |
| 2519 return inner_pointer_to_code_cache()->GcSafeFindCodeForInnerPointer(a); |
| 2520 } |
| 2521 |
| 2522 |
| 2511 #ifdef DEBUG | 2523 #ifdef DEBUG |
| 2512 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ | 2524 #define ISOLATE_FIELD_OFFSET(type, name, ignored) \ |
| 2513 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); | 2525 const intptr_t Isolate::name##_debug_offset_ = OFFSET_OF(Isolate, name##_); |
| 2514 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) | 2526 ISOLATE_INIT_LIST(ISOLATE_FIELD_OFFSET) |
| 2515 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) | 2527 ISOLATE_INIT_ARRAY_LIST(ISOLATE_FIELD_OFFSET) |
| 2516 #undef ISOLATE_FIELD_OFFSET | 2528 #undef ISOLATE_FIELD_OFFSET |
| 2517 #endif | 2529 #endif |
| 2518 | 2530 |
| 2519 } } // namespace v8::internal | 2531 } } // namespace v8::internal |
| OLD | NEW |