OLD | NEW |
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 #include <stdlib.h> | 5 #include <stdlib.h> |
6 | 6 |
7 #include <fstream> // NOLINT(readability/streams) | 7 #include <fstream> // NOLINT(readability/streams) |
8 | 8 |
9 #include "src/v8.h" | 9 #include "src/v8.h" |
10 | 10 |
(...skipping 1937 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1948 clear_scheduled_exception(); | 1948 clear_scheduled_exception(); |
1949 | 1949 |
1950 // Deserializing may put strange things in the root array's copy of the | 1950 // Deserializing may put strange things in the root array's copy of the |
1951 // stack guard. | 1951 // stack guard. |
1952 heap_.SetStackLimits(); | 1952 heap_.SetStackLimits(); |
1953 | 1953 |
1954 // Quiet the heap NaN if needed on target platform. | 1954 // Quiet the heap NaN if needed on target platform. |
1955 if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value()); | 1955 if (!create_heap_objects) Assembler::QuietNaN(heap_.nan_value()); |
1956 | 1956 |
1957 if (FLAG_trace_turbo) { | 1957 if (FLAG_trace_turbo) { |
1958 // Erase the file. | 1958 // Create an empty file. |
1959 char buffer[512]; | 1959 std::ofstream(GetTurboCfgFileName(), std::ios_base::trunc); |
1960 Vector<char> filename(buffer, sizeof(buffer)); | |
1961 GetTurboCfgFileName(filename); | |
1962 std::ofstream turbo_cfg_stream(filename.start(), | |
1963 std::fstream::out | std::fstream::trunc); | |
1964 } | 1960 } |
1965 | 1961 |
1966 // If we are deserializing, log non-function code objects and compiled | 1962 // If we are deserializing, log non-function code objects and compiled |
1967 // functions found in the snapshot. | 1963 // functions found in the snapshot. |
1968 if (!create_heap_objects && | 1964 if (!create_heap_objects && |
1969 (FLAG_log_code || | 1965 (FLAG_log_code || |
1970 FLAG_ll_prof || | 1966 FLAG_ll_prof || |
1971 FLAG_perf_jit_prof || | 1967 FLAG_perf_jit_prof || |
1972 FLAG_perf_basic_prof || | 1968 FLAG_perf_basic_prof || |
1973 logger_->is_logging_code_events())) { | 1969 logger_->is_logging_code_events())) { |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2369 | 2365 |
2370 | 2366 |
2371 BasicBlockProfiler* Isolate::GetOrCreateBasicBlockProfiler() { | 2367 BasicBlockProfiler* Isolate::GetOrCreateBasicBlockProfiler() { |
2372 if (basic_block_profiler_ == NULL) { | 2368 if (basic_block_profiler_ == NULL) { |
2373 basic_block_profiler_ = new BasicBlockProfiler(); | 2369 basic_block_profiler_ = new BasicBlockProfiler(); |
2374 } | 2370 } |
2375 return basic_block_profiler_; | 2371 return basic_block_profiler_; |
2376 } | 2372 } |
2377 | 2373 |
2378 | 2374 |
2379 void Isolate::GetTurboCfgFileName(Vector<char> filename) { | 2375 std::string Isolate::GetTurboCfgFileName() { |
2380 if (FLAG_trace_turbo_cfg_file == NULL) { | 2376 return FLAG_trace_turbo_cfg_file == NULL |
2381 SNPrintF(filename, "turbo-%d-%d.cfg", base::OS::GetCurrentProcessId(), | 2377 ? "turbo-" + std::to_string(base::OS::GetCurrentProcessId()) + |
2382 id()); | 2378 "-" + std::to_string(id()) + ".cfg" |
2383 } else { | 2379 : FLAG_trace_turbo_cfg_file; |
2384 StrNCpy(filename, FLAG_trace_turbo_cfg_file, filename.length()); | |
2385 } | |
2386 } | 2380 } |
2387 | 2381 |
2388 | 2382 |
2389 bool StackLimitCheck::JsHasOverflowed() const { | 2383 bool StackLimitCheck::JsHasOverflowed() const { |
2390 StackGuard* stack_guard = isolate_->stack_guard(); | 2384 StackGuard* stack_guard = isolate_->stack_guard(); |
2391 #ifdef USE_SIMULATOR | 2385 #ifdef USE_SIMULATOR |
2392 // The simulator uses a separate JS stack. | 2386 // The simulator uses a separate JS stack. |
2393 Address jssp_address = Simulator::current(isolate_)->get_sp(); | 2387 Address jssp_address = Simulator::current(isolate_)->get_sp(); |
2394 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); | 2388 uintptr_t jssp = reinterpret_cast<uintptr_t>(jssp_address); |
2395 if (jssp < stack_guard->real_jslimit()) return true; | 2389 if (jssp < stack_guard->real_jslimit()) return true; |
2396 #endif // USE_SIMULATOR | 2390 #endif // USE_SIMULATOR |
2397 return GetCurrentStackPosition() < stack_guard->real_climit(); | 2391 return GetCurrentStackPosition() < stack_guard->real_climit(); |
2398 } | 2392 } |
2399 | 2393 |
2400 | 2394 |
2401 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { | 2395 bool PostponeInterruptsScope::Intercept(StackGuard::InterruptFlag flag) { |
2402 // First check whether the previous scope intercepts. | 2396 // First check whether the previous scope intercepts. |
2403 if (prev_ && prev_->Intercept(flag)) return true; | 2397 if (prev_ && prev_->Intercept(flag)) return true; |
2404 // Then check whether this scope intercepts. | 2398 // Then check whether this scope intercepts. |
2405 if ((flag & intercept_mask_)) { | 2399 if ((flag & intercept_mask_)) { |
2406 intercepted_flags_ |= flag; | 2400 intercepted_flags_ |= flag; |
2407 return true; | 2401 return true; |
2408 } | 2402 } |
2409 return false; | 2403 return false; |
2410 } | 2404 } |
2411 | 2405 |
2412 } } // namespace v8::internal | 2406 } } // namespace v8::internal |
OLD | NEW |