Revert "GetCurrentStackPosition() -> base::Stack::GetCurrentStackPosition()"
This reverts commit 8156dd85fc
.
Reason for revert: https://ci.chromium.org/ui/p/v8/builders/ci/V8%20Win64%20ASAN/15800/overview
Original change's description:
> GetCurrentStackPosition() -> base::Stack::GetCurrentStackPosition()
>
> Remove the duplicate utility function and use the base::Stack
> equivalent instead which provides more stack utilitiy functionality.
>
> Change-Id: Ia7a79f2530b64ceb6e2ce33445c876980b4b2a3d
> Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2509595
> Reviewed-by: Toon Verwaest <verwaest@chromium.org>
> Reviewed-by: Clemens Backes <clemensb@chromium.org>
> Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#70930}
TBR=mlippautz@chromium.org,clemensb@chromium.org,verwaest@chromium.org
Change-Id: Id18949a3c82171e74370e729cd303607d46c8805
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2515431
Reviewed-by: Sathya Gunasekaran <gsathya@chromium.org>
Commit-Queue: Sathya Gunasekaran <gsathya@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70940}
This commit is contained in:
parent
4a26b54d63
commit
df7a86c3bf
@ -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; \
|
||||
|
@ -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() \
|
||||
|
@ -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;
|
||||
|
@ -8,14 +8,12 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#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<uintptr_t>(get_sp());
|
||||
}
|
||||
|
||||
|
@ -7,14 +7,12 @@
|
||||
#if defined(USE_SIMULATOR)
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cmath>
|
||||
#include <cstdarg>
|
||||
#include <type_traits>
|
||||
|
||||
#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();
|
||||
}
|
||||
|
||||
|
@ -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<Code> 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
|
||||
|
@ -4586,8 +4586,7 @@ bool StackLimitCheck::JsHasOverflowed(uintptr_t gap) const {
|
||||
uintptr_t jssp = static_cast<uintptr_t>(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) {
|
||||
|
@ -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.
|
||||
|
@ -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
|
||||
|
@ -10,12 +10,10 @@
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#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<uintptr_t>(get_sp());
|
||||
}
|
||||
|
||||
|
@ -10,11 +10,9 @@
|
||||
#include <limits.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#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<uintptr_t>(get_sp());
|
||||
}
|
||||
|
||||
|
@ -8,12 +8,10 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#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<uintptr_t>(get_sp());
|
||||
}
|
||||
|
||||
|
@ -9,12 +9,10 @@
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#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<uintptr_t>(get_sp());
|
||||
}
|
||||
|
||||
|
@ -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(
|
||||
|
@ -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;
|
||||
|
@ -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<Address>(GetCurrentStackPosition());
|
||||
}
|
||||
#endif
|
||||
|
||||
|
@ -6,7 +6,6 @@
|
||||
#define V8_PARSING_PARSER_BASE_H_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
@ -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(); }
|
||||
|
@ -303,6 +303,14 @@ bool DoubleToBoolean(double d) {
|
||||
return true;
|
||||
}
|
||||
|
||||
uintptr_t GetCurrentStackPosition() {
|
||||
#if V8_CC_MSVC
|
||||
return reinterpret_cast<uintptr_t>(_AddressOfReturnAddress());
|
||||
#else
|
||||
return reinterpret_cast<uintptr_t>(__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
|
||||
|
@ -667,6 +667,12 @@ template <typename Stream, typename index_t,
|
||||
enum ToIndexMode mode = kToArrayIndex>
|
||||
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);
|
||||
|
@ -4,14 +4,14 @@
|
||||
|
||||
#include <tuple>
|
||||
|
||||
#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();
|
||||
|
@ -31,16 +31,16 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#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<v8::Context> 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<v8::Context> 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<v8::Context> 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<v8::Context> 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<v8::Context> 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<v8::Context> 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<v8::Context> 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<v8::Context> 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<v8::Context> 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<v8::Context> 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<i::Script> script =
|
||||
|
Loading…
Reference in New Issue
Block a user