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