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