diff --git a/src/asmjs/asm-parser.cc b/src/asmjs/asm-parser.cc index cda4d85c6e..42179bace1 100644 --- a/src/asmjs/asm-parser.cc +++ b/src/asmjs/asm-parser.cc @@ -13,7 +13,6 @@ #include "src/asmjs/asm-types.h" #include "src/base/optional.h" #include "src/base/overflowing-math.h" -#include "src/base/platform/platform.h" #include "src/flags/flags.h" #include "src/numbers/conversions-inl.h" #include "src/parsing/scanner.h" @@ -59,7 +58,7 @@ namespace wasm { #define RECURSE_OR_RETURN(ret, call) \ do { \ DCHECK(!failed_); \ - if (base::Stack::GetCurrentStackPosition() < stack_limit_) { \ + if (GetCurrentStackPosition() < stack_limit_) { \ FAIL_AND_RETURN(ret, "Stack overflow while parsing asm.js module."); \ } \ call; \ diff --git a/src/ast/ast.h b/src/ast/ast.h index cfd6ca4cab..7b70181e6a 100644 --- a/src/ast/ast.h +++ b/src/ast/ast.h @@ -10,7 +10,6 @@ #include "src/ast/ast-value-factory.h" #include "src/ast/modules.h" #include "src/ast/variables.h" -#include "src/base/platform/platform.h" #include "src/base/threaded-list.h" #include "src/codegen/bailout-reason.h" #include "src/codegen/label.h" @@ -2669,45 +2668,45 @@ class AstVisitor { FAILURE_NODE_LIST(GENERATE_FAILURE_CASE) \ } -#define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ - public: \ - void VisitNoStackOverflowCheck(AstNode* node) { \ - GENERATE_AST_VISITOR_SWITCH() \ - } \ - \ - void Visit(AstNode* node) { \ - if (CheckStackOverflow()) return; \ - VisitNoStackOverflowCheck(node); \ - } \ - \ - void SetStackOverflow() { stack_overflow_ = true; } \ - void ClearStackOverflow() { stack_overflow_ = false; } \ - bool HasStackOverflow() const { return stack_overflow_; } \ - \ - bool CheckStackOverflow() { \ - if (stack_overflow_) return true; \ - if (base::Stack::GetCurrentStackPosition() < stack_limit_) { \ - stack_overflow_ = true; \ - return true; \ - } \ - return false; \ - } \ - \ - protected: \ - uintptr_t stack_limit() const { return stack_limit_; } \ - \ - private: \ - void InitializeAstVisitor(Isolate* isolate) { \ - stack_limit_ = isolate->stack_guard()->real_climit(); \ - stack_overflow_ = false; \ - } \ - \ - void InitializeAstVisitor(uintptr_t stack_limit) { \ - stack_limit_ = stack_limit; \ - stack_overflow_ = false; \ - } \ - \ - uintptr_t stack_limit_; \ +#define DEFINE_AST_VISITOR_SUBCLASS_MEMBERS() \ + public: \ + void VisitNoStackOverflowCheck(AstNode* node) { \ + GENERATE_AST_VISITOR_SWITCH() \ + } \ + \ + void Visit(AstNode* node) { \ + if (CheckStackOverflow()) return; \ + VisitNoStackOverflowCheck(node); \ + } \ + \ + void SetStackOverflow() { stack_overflow_ = true; } \ + void ClearStackOverflow() { stack_overflow_ = false; } \ + bool HasStackOverflow() const { return stack_overflow_; } \ + \ + bool CheckStackOverflow() { \ + if (stack_overflow_) return true; \ + if (GetCurrentStackPosition() < stack_limit_) { \ + stack_overflow_ = true; \ + return true; \ + } \ + return false; \ + } \ + \ + protected: \ + uintptr_t stack_limit() const { return stack_limit_; } \ + \ + private: \ + void InitializeAstVisitor(Isolate* isolate) { \ + stack_limit_ = isolate->stack_guard()->real_climit(); \ + stack_overflow_ = false; \ + } \ + \ + void InitializeAstVisitor(uintptr_t stack_limit) { \ + stack_limit_ = stack_limit; \ + stack_overflow_ = false; \ + } \ + \ + uintptr_t stack_limit_; \ bool stack_overflow_ #define DEFINE_AST_VISITOR_MEMBERS_WITHOUT_STACKOVERFLOW() \ diff --git a/src/codegen/compiler.cc b/src/codegen/compiler.cc index 8f3e1b1f3c..879bc0285d 100644 --- a/src/codegen/compiler.cc +++ b/src/codegen/compiler.cc @@ -13,7 +13,6 @@ #include "src/ast/scopes.h" #include "src/base/logging.h" #include "src/base/optional.h" -#include "src/base/platform/platform.h" #include "src/codegen/assembler-inl.h" #include "src/codegen/compilation-cache.h" #include "src/codegen/optimized-compilation-info.h" @@ -1503,9 +1502,8 @@ class OffThreadParseInfoScope { original_runtime_call_stats_(parse_info_->runtime_call_stats()), original_stack_limit_(parse_info_->stack_limit()), worker_thread_scope_(worker_thread_runtime_stats) { - parse_info_->SetPerThreadState( - base::Stack::GetCurrentStackPosition() - stack_size * KB, - worker_thread_scope_.Get()); + parse_info_->SetPerThreadState(GetCurrentStackPosition() - stack_size * KB, + worker_thread_scope_.Get()); } ~OffThreadParseInfoScope() { @@ -1645,8 +1643,7 @@ bool Compiler::CollectSourcePositions(Isolate* isolate, // the parser so it aborts without setting a pending exception, which then // gets thrown. This would avoid the situation where potentially we'd reparse // several times (running out of stack each time) before hitting this limit. - if (base::Stack::GetCurrentStackPosition() < - isolate->stack_guard()->real_climit()) { + if (GetCurrentStackPosition() < isolate->stack_guard()->real_climit()) { // Stack is already exhausted. bytecode->SetSourcePositionsFailedToCollect(); return false; diff --git a/src/execution/arm/simulator-arm.cc b/src/execution/arm/simulator-arm.cc index 0f3fe39765..0fb13e7f2e 100644 --- a/src/execution/arm/simulator-arm.cc +++ b/src/execution/arm/simulator-arm.cc @@ -8,14 +8,12 @@ #include #include - #include #include "src/base/bits.h" #include "src/base/lazy-instance.h" #include "src/base/memory.h" #include "src/base/overflowing-math.h" -#include "src/base/platform/platform.h" #include "src/codegen/arm/constants-arm.h" #include "src/codegen/assembler-inl.h" #include "src/codegen/macro-assembler.h" @@ -1084,7 +1082,7 @@ int Simulator::WriteExDW(int32_t addr, int32_t value1, int32_t value2) { uintptr_t Simulator::StackLimit(uintptr_t c_limit) const { // The simulator uses a separate JS stack. If we have exhausted the C stack, // we also drop down the JS limit to reflect the exhaustion on the JS stack. - if (base::Stack::GetCurrentStackPosition() < c_limit) { + if (GetCurrentStackPosition() < c_limit) { return reinterpret_cast(get_sp()); } diff --git a/src/execution/arm64/simulator-arm64.cc b/src/execution/arm64/simulator-arm64.cc index af6d3241a5..4d9205f053 100644 --- a/src/execution/arm64/simulator-arm64.cc +++ b/src/execution/arm64/simulator-arm64.cc @@ -7,14 +7,12 @@ #if defined(USE_SIMULATOR) #include - #include #include #include #include "src/base/lazy-instance.h" #include "src/base/overflowing-math.h" -#include "src/base/platform/platform.h" #include "src/codegen/arm64/decoder-arm64-inl.h" #include "src/codegen/assembler-inl.h" #include "src/codegen/macro-assembler.h" @@ -285,7 +283,7 @@ uintptr_t Simulator::PopAddress() { uintptr_t Simulator::StackLimit(uintptr_t c_limit) const { // The simulator uses a separate JS stack. If we have exhausted the C stack, // we also drop down the JS limit to reflect the exhaustion on the JS stack. - if (base::Stack::GetCurrentStackPosition() < c_limit) { + if (GetCurrentStackPosition() < c_limit) { return get_sp(); } diff --git a/src/execution/execution.cc b/src/execution/execution.cc index d58e96d5e2..3da4cbdbaf 100644 --- a/src/execution/execution.cc +++ b/src/execution/execution.cc @@ -5,7 +5,6 @@ #include "src/execution/execution.h" #include "src/api/api-inl.h" -#include "src/base/platform/platform.h" #include "src/compiler/wasm-compiler.h" // Only for static asserts. #include "src/execution/frames.h" #include "src/execution/isolate-inl.h" @@ -534,12 +533,12 @@ void Execution::CallWasm(Isolate* isolate, Handle wrapper_code, Address saved_c_entry_fp = *isolate->c_entry_fp_address(); Address saved_js_entry_sp = *isolate->js_entry_sp_address(); if (saved_js_entry_sp == kNullAddress) { - *isolate->js_entry_sp_address() = base::Stack::GetCurrentStackPosition(); + *isolate->js_entry_sp_address() = GetCurrentStackPosition(); } StackHandlerMarker stack_handler; stack_handler.next = isolate->thread_local_top()->handler_; #ifdef V8_USE_ADDRESS_SANITIZER - stack_handler.padding = base::Stack::GetCurrentStackPosition(); + stack_handler.padding = GetCurrentStackPosition(); #else stack_handler.padding = 0; #endif diff --git a/src/execution/isolate.cc b/src/execution/isolate.cc index 968e8ab155..1c1380061b 100644 --- a/src/execution/isolate.cc +++ b/src/execution/isolate.cc @@ -4586,8 +4586,7 @@ bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const { uintptr_t jssp = static_cast(jssp_address); if (jssp - gap < stack_guard->real_jslimit()) return true; #endif // USE_SIMULATOR - return base::Stack::GetCurrentStackPosition() - gap < - stack_guard->real_climit(); + return GetCurrentStackPosition() - gap < stack_guard->real_climit(); } SaveContext::SaveContext(Isolate* isolate) : isolate_(isolate) { diff --git a/src/execution/isolate.h b/src/execution/isolate.h index a56501d29f..42d4ae6816 100644 --- a/src/execution/isolate.h +++ b/src/execution/isolate.h @@ -19,7 +19,6 @@ #include "include/v8.h" #include "src/base/macros.h" #include "src/base/platform/mutex.h" -#include "src/base/platform/platform.h" #include "src/builtins/builtins.h" #include "src/common/globals.h" #include "src/debug/interface-types.h" @@ -2092,14 +2091,14 @@ class StackLimitCheck { // Use this to check for stack-overflows in C++ code. bool HasOverflowed() const { StackGuard* stack_guard = isolate_->stack_guard(); - return base::Stack::GetCurrentStackPosition() < stack_guard->real_climit(); + return GetCurrentStackPosition() < stack_guard->real_climit(); } static bool HasOverflowed(LocalIsolate* local_isolate); // Use this to check for interrupt request in C++ code. bool InterruptRequested() { StackGuard* stack_guard = isolate_->stack_guard(); - return base::Stack::GetCurrentStackPosition() < stack_guard->climit(); + return GetCurrentStackPosition() < stack_guard->climit(); } // Use this to check for stack-overflow when entering runtime from JS code. diff --git a/src/execution/local-isolate.cc b/src/execution/local-isolate.cc index adea8c0635..77733907f8 100644 --- a/src/execution/local-isolate.cc +++ b/src/execution/local-isolate.cc @@ -4,7 +4,6 @@ #include "src/execution/local-isolate.h" -#include "src/base/platform/platform.h" #include "src/execution/isolate.h" #include "src/execution/thread-id.h" #include "src/handles/handles-inl.h" @@ -21,8 +20,7 @@ LocalIsolate::LocalIsolate(Isolate* isolate, ThreadKind kind) thread_id_(ThreadId::Current()), stack_limit_(kind == ThreadKind::kMain ? isolate->stack_guard()->real_climit() - : base::Stack::GetCurrentStackPosition() - - FLAG_stack_size * KB) {} + : GetCurrentStackPosition() - FLAG_stack_size * KB) {} LocalIsolate::~LocalIsolate() = default; @@ -41,7 +39,7 @@ bool LocalIsolate::is_collecting_type_profile() const { // static bool StackLimitCheck::HasOverflowed(LocalIsolate* local_isolate) { - return base::Stack::GetCurrentStackPosition() < local_isolate->stack_limit(); + return GetCurrentStackPosition() < local_isolate->stack_limit(); } } // namespace internal diff --git a/src/execution/mips/simulator-mips.cc b/src/execution/mips/simulator-mips.cc index 23f557eeb8..76b65f404a 100644 --- a/src/execution/mips/simulator-mips.cc +++ b/src/execution/mips/simulator-mips.cc @@ -10,12 +10,10 @@ #include #include #include - #include #include "src/base/bits.h" #include "src/base/lazy-instance.h" -#include "src/base/platform/platform.h" #include "src/codegen/assembler-inl.h" #include "src/codegen/macro-assembler.h" #include "src/codegen/mips/constants-mips.h" @@ -2137,7 +2135,7 @@ void Simulator::WriteMem(int32_t addr, T value, Instruction* instr) { uintptr_t Simulator::StackLimit(uintptr_t c_limit) const { // The simulator uses a separate JS stack. If we have exhausted the C stack, // we also drop down the JS limit to reflect the exhaustion on the JS stack. - if (base::Stack::GetCurrentStackPosition() < c_limit) { + if (GetCurrentStackPosition() < c_limit) { return reinterpret_cast(get_sp()); } diff --git a/src/execution/mips64/simulator-mips64.cc b/src/execution/mips64/simulator-mips64.cc index ff684891ac..72f2836329 100644 --- a/src/execution/mips64/simulator-mips64.cc +++ b/src/execution/mips64/simulator-mips64.cc @@ -10,11 +10,9 @@ #include #include #include - #include #include "src/base/bits.h" -#include "src/base/platform/platform.h" #include "src/codegen/assembler-inl.h" #include "src/codegen/macro-assembler.h" #include "src/codegen/mips64/constants-mips64.h" @@ -2142,7 +2140,7 @@ void Simulator::WriteMem(int64_t addr, T value, Instruction* instr) { uintptr_t Simulator::StackLimit(uintptr_t c_limit) const { // The simulator uses a separate JS stack. If we have exhausted the C stack, // we also drop down the JS limit to reflect the exhaustion on the JS stack. - if (base::Stack::GetCurrentStackPosition() < c_limit) { + if (GetCurrentStackPosition() < c_limit) { return reinterpret_cast(get_sp()); } diff --git a/src/execution/ppc/simulator-ppc.cc b/src/execution/ppc/simulator-ppc.cc index becc12cbb9..8e7070e5dc 100644 --- a/src/execution/ppc/simulator-ppc.cc +++ b/src/execution/ppc/simulator-ppc.cc @@ -8,12 +8,10 @@ #include #include - #include #include "src/base/bits.h" #include "src/base/lazy-instance.h" -#include "src/base/platform/platform.h" #include "src/codegen/assembler.h" #include "src/codegen/macro-assembler.h" #include "src/codegen/ppc/constants-ppc.h" @@ -871,7 +869,7 @@ RW_VAR_LIST(GENERATE_RW_FUNC) uintptr_t Simulator::StackLimit(uintptr_t c_limit) const { // The simulator uses a separate JS stack. If we have exhausted the C stack, // we also drop down the JS limit to reflect the exhaustion on the JS stack. - if (base::Stack::GetCurrentStackPosition() < c_limit) { + if (GetCurrentStackPosition() < c_limit) { return reinterpret_cast(get_sp()); } diff --git a/src/execution/s390/simulator-s390.cc b/src/execution/s390/simulator-s390.cc index b4bcb29dbd..a9fc318e4b 100644 --- a/src/execution/s390/simulator-s390.cc +++ b/src/execution/s390/simulator-s390.cc @@ -9,12 +9,10 @@ #include #include - #include #include "src/base/bits.h" #include "src/base/once.h" -#include "src/base/platform/platform.h" #include "src/codegen/assembler.h" #include "src/codegen/macro-assembler.h" #include "src/codegen/register-configuration.h" @@ -1814,7 +1812,7 @@ float Simulator::ReadFloat(intptr_t addr) { uintptr_t Simulator::StackLimit(uintptr_t c_limit) const { // The simulator uses a separate JS stack. If we have exhausted the C stack, // we also drop down the JS limit to reflect the exhaustion on the JS stack. - if (base::Stack::GetCurrentStackPosition() < c_limit) { + if (GetCurrentStackPosition() < c_limit) { return reinterpret_cast(get_sp()); } diff --git a/src/execution/simulator.h b/src/execution/simulator.h index 0dce6f2c3e..74763474c6 100644 --- a/src/execution/simulator.h +++ b/src/execution/simulator.h @@ -5,7 +5,6 @@ #ifndef V8_EXECUTION_SIMULATOR_H_ #define V8_EXECUTION_SIMULATOR_H_ -#include "src/base/platform/platform.h" #include "src/common/globals.h" #include "src/objects/code.h" @@ -83,7 +82,7 @@ class SimulatorStack : public v8::internal::AllStatic { static inline uintptr_t RegisterJSStackComparableAddress( v8::internal::Isolate* isolate) { USE(isolate); - return v8::base::Stack::GetCurrentStackPosition(); + return internal::GetCurrentStackPosition(); } static inline void UnregisterJSStackComparableAddress( diff --git a/src/execution/stack-guard.cc b/src/execution/stack-guard.cc index dfb728db30..a98fb07c93 100644 --- a/src/execution/stack-guard.cc +++ b/src/execution/stack-guard.cc @@ -4,7 +4,6 @@ #include "src/execution/stack-guard.h" -#include "src/base/platform/platform.h" #include "src/compiler-dispatcher/optimizing-compile-dispatcher.h" #include "src/execution/interrupts-scope.h" #include "src/execution/isolate.h" @@ -201,8 +200,8 @@ void StackGuard::FreeThreadResources() { void StackGuard::ThreadLocal::Initialize(Isolate* isolate, const ExecutionAccess& lock) { const uintptr_t kLimitSize = FLAG_stack_size * KB; - DCHECK_GT(base::Stack::GetCurrentStackPosition(), kLimitSize); - uintptr_t limit = base::Stack::GetCurrentStackPosition() - kLimitSize; + DCHECK_GT(GetCurrentStackPosition(), kLimitSize); + uintptr_t limit = GetCurrentStackPosition() - kLimitSize; real_jslimit_ = SimulatorStack::JsLimitFromCLimit(isolate, limit); set_jslimit(SimulatorStack::JsLimitFromCLimit(isolate, limit)); real_climit_ = limit; diff --git a/src/execution/thread-local-top.cc b/src/execution/thread-local-top.cc index 115a1ed048..84d3432aec 100644 --- a/src/execution/thread-local-top.cc +++ b/src/execution/thread-local-top.cc @@ -3,8 +3,6 @@ // found in the LICENSE file. #include "src/execution/thread-local-top.h" - -#include "src/base/platform/platform.h" #include "src/execution/isolate.h" #include "src/execution/simulator.h" #include "src/trap-handler/trap-handler.h" @@ -38,7 +36,7 @@ void ThreadLocalTop::StoreCurrentStackPosition() { } #elif defined(V8_USE_ADDRESS_SANITIZER) void ThreadLocalTop::StoreCurrentStackPosition() { - last_api_entry_ = base::Stack::GetCurrentStackPosition(); + last_api_entry_ = reinterpret_cast
(GetCurrentStackPosition()); } #endif diff --git a/src/parsing/parser-base.h b/src/parsing/parser-base.h index 768f567d09..37de4ef4f5 100644 --- a/src/parsing/parser-base.h +++ b/src/parsing/parser-base.h @@ -6,7 +6,6 @@ #define V8_PARSING_PARSER_BASE_H_ #include - #include #include @@ -15,7 +14,6 @@ #include "src/ast/scopes.h" #include "src/base/flags.h" #include "src/base/hashmap.h" -#include "src/base/platform/platform.h" #include "src/base/v8-fallthrough.h" #include "src/codegen/bailout-reason.h" #include "src/common/globals.h" @@ -858,9 +856,7 @@ class ParserBase { } void CheckStackOverflow() { // Any further calls to Next or peek will return the illegal token. - if (base::Stack::GetCurrentStackPosition() < stack_limit_) { - set_stack_overflow(); - } + if (GetCurrentStackPosition() < stack_limit_) set_stack_overflow(); } V8_INLINE Token::Value peek() { return scanner()->peek(); } diff --git a/src/utils/utils.cc b/src/utils/utils.cc index 8527f837b4..827fd511c6 100644 --- a/src/utils/utils.cc +++ b/src/utils/utils.cc @@ -303,6 +303,14 @@ bool DoubleToBoolean(double d) { return true; } +uintptr_t GetCurrentStackPosition() { +#if V8_CC_MSVC + return reinterpret_cast(_AddressOfReturnAddress()); +#else + return reinterpret_cast(__builtin_frame_address(0)); +#endif +} + // The filter is a pattern that matches function names in this way: // "*" all; the default // "-" all but the top-level function diff --git a/src/utils/utils.h b/src/utils/utils.h index 0d68fa2dae..9bbea8b3c1 100644 --- a/src/utils/utils.h +++ b/src/utils/utils.h @@ -667,6 +667,12 @@ template bool StringToIndex(Stream* stream, index_t* index); +// Returns the current stack top. Works correctly with ASAN and SafeStack. +// GetCurrentStackPosition() should not be inlined, because it works on stack +// frames if it were inlined into a function with a huge stack frame it would +// return an address significantly above the actual current stack position. +V8_EXPORT_PRIVATE V8_NOINLINE uintptr_t GetCurrentStackPosition(); + static inline uint16_t ByteReverse16(uint16_t value) { #if V8_HAS_BUILTIN_BSWAP16 return __builtin_bswap16(value); diff --git a/test/cctest/interpreter/test-interpreter.cc b/test/cctest/interpreter/test-interpreter.cc index 2b2be59679..af899f0852 100644 --- a/test/cctest/interpreter/test-interpreter.cc +++ b/test/cctest/interpreter/test-interpreter.cc @@ -4,14 +4,14 @@ #include +#include "src/init/v8.h" + #include "src/api/api-inl.h" #include "src/base/overflowing-math.h" -#include "src/base/platform/platform.h" #include "src/codegen/compiler.h" #include "src/execution/execution.h" #include "src/handles/handles.h" #include "src/heap/heap-inl.h" -#include "src/init/v8.h" #include "src/interpreter/bytecode-array-builder.h" #include "src/interpreter/bytecode-array-iterator.h" #include "src/interpreter/bytecode-flags.h" @@ -5152,7 +5152,7 @@ TEST(InterpreterCollectSourcePositions_StackOverflow) { // Make the stack limit the same as the current position so recompilation // overflows. uint64_t previous_limit = isolate->stack_guard()->real_climit(); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition()); + isolate->stack_guard()->SetStackLimit(GetCurrentStackPosition()); Compiler::CollectSourcePositions(isolate, sfi); // Stack overflowed so source position table can be returned but is empty. ByteArray source_position_table = bytecode_array->SourcePositionTable(); diff --git a/test/cctest/test-parsing.cc b/test/cctest/test-parsing.cc index 630fbc197e..47281637a2 100644 --- a/test/cctest/test-parsing.cc +++ b/test/cctest/test-parsing.cc @@ -31,16 +31,16 @@ #include +#include "src/init/v8.h" + #include "src/api/api-inl.h" #include "src/ast/ast-value-factory.h" #include "src/ast/ast.h" #include "src/base/enum-set.h" -#include "src/base/platform/platform.h" #include "src/codegen/compiler.h" #include "src/execution/execution.h" #include "src/execution/isolate.h" #include "src/flags/flags.h" -#include "src/init/v8.h" #include "src/objects/objects-inl.h" #include "src/objects/objects.h" #include "src/parsing/parse-info.h" @@ -51,6 +51,7 @@ #include "src/parsing/scanner-character-streams.h" #include "src/parsing/token.h" #include "src/zone/zone-list-inl.h" // crbug.com/v8/8816 + #include "test/cctest/cctest.h" #include "test/cctest/scope-test-helper.h" #include "test/cctest/unicode-helpers.h" @@ -663,8 +664,8 @@ TEST(ScanHTMLEndComments) { // clang-format on // Parser/Scanner needs a stack limit. - i_isolate->stack_guard()->SetStackLimit( - base::Stack::GetCurrentStackPosition() - 128 * 1024); + i_isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - + 128 * 1024); uintptr_t stack_limit = i_isolate->stack_guard()->real_climit(); for (int i = 0; tests[i]; i++) { const char* source = tests[i]; @@ -752,8 +753,8 @@ TEST(StandAlonePreParser) { i::UnoptimizedCompileFlags::ForTest(i_isolate); flags.set_allow_natives_syntax(true); - i_isolate->stack_guard()->SetStackLimit( - base::Stack::GetCurrentStackPosition() - 128 * 1024); + i_isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - + 128 * 1024); const char* programs[] = {"{label: 42}", "var x = 42;", @@ -790,7 +791,7 @@ TEST(StandAlonePreParserNoNatives) { i::UnoptimizedCompileFlags flags = i::UnoptimizedCompileFlags::ForTest(isolate); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); const char* programs[] = {"%ArgleBargle(glop);", "var x = %_IsSmi(42);", @@ -825,7 +826,7 @@ TEST(RegressChromium62639) { i::UnoptimizedCompileFlags flags = i::UnoptimizedCompileFlags::ForTest(isolate); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); const char* program = "var x = 'something';\n" @@ -860,7 +861,7 @@ TEST(PreParseOverflow) { i::UnoptimizedCompileFlags flags = i::UnoptimizedCompileFlags::ForTest(isolate); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); size_t kProgramSize = 1024 * 1024; @@ -1104,7 +1105,7 @@ TEST(ScopeUsesArgumentsSuperThis) { v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); for (unsigned j = 0; j < arraysize(surroundings); ++j) { @@ -1478,7 +1479,7 @@ TEST(ScopePositions) { v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); for (int i = 0; source_data[i].outer_prefix; i++) { @@ -1844,7 +1845,7 @@ TEST(ParserSync) { v8::Context::Scope context_scope(context); CcTest::i_isolate()->stack_guard()->SetStackLimit( - base::Stack::GetCurrentStackPosition() - 128 * 1024); + i::GetCurrentStackPosition() - 128 * 1024); for (int i = 0; context_data[i][0] != nullptr; ++i) { for (int j = 0; statement_data[j] != nullptr; ++j) { @@ -1918,7 +1919,7 @@ void RunParserSyncTest( v8::Context::Scope context_scope(context); CcTest::i_isolate()->stack_guard()->SetStackLimit( - base::Stack::GetCurrentStackPosition() - 128 * 1024); + i::GetCurrentStackPosition() - 128 * 1024); // Experimental feature flags should not go here; pass the flags as // always_true_flags if the test needs them. @@ -5035,7 +5036,7 @@ TEST(BasicImportAssertionParsing) { v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); for (unsigned i = 0; i < arraysize(kSources); ++i) { @@ -5104,7 +5105,7 @@ TEST(ImportAssertionParsingErrors) { v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); for (unsigned i = 0; i < arraysize(kErrorSources); ++i) { @@ -7614,7 +7615,7 @@ TEST(BasicImportExportParsing) { v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); for (unsigned i = 0; i < arraysize(kSources); ++i) { @@ -7669,7 +7670,7 @@ TEST(NamespaceExportParsing) { v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); for (unsigned i = 0; i < arraysize(kSources); ++i) { @@ -7766,7 +7767,7 @@ TEST(ImportExportParsingErrors) { v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); for (unsigned i = 0; i < arraysize(kErrorSources); ++i) { @@ -7806,7 +7807,7 @@ TEST(ModuleTopLevelFunctionDecl) { v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); for (unsigned i = 0; i < arraysize(kErrorSources); ++i) { @@ -7990,7 +7991,7 @@ TEST(ModuleParsingInternals) { v8::HandleScope handles(CcTest::isolate()); v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); static const char kSource[] = @@ -8256,7 +8257,7 @@ void TestLanguageMode(const char* source, v8::HandleScope handles(CcTest::isolate()); v8::Local context = v8::Context::New(CcTest::isolate()); v8::Context::Scope context_scope(context); - isolate->stack_guard()->SetStackLimit(base::Stack::GetCurrentStackPosition() - + isolate->stack_guard()->SetStackLimit(i::GetCurrentStackPosition() - 128 * 1024); i::Handle script =