summaryrefslogtreecommitdiff
path: root/chromium/v8/src/assembler.h
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/v8/src/assembler.h')
-rw-r--r--chromium/v8/src/assembler.h95
1 files changed, 50 insertions, 45 deletions
diff --git a/chromium/v8/src/assembler.h b/chromium/v8/src/assembler.h
index 433b9b8456d..08c6b38541c 100644
--- a/chromium/v8/src/assembler.h
+++ b/chromium/v8/src/assembler.h
@@ -38,8 +38,8 @@
#include "src/allocation.h"
#include "src/builtins.h"
#include "src/isolate.h"
+#include "src/parsing/token.h"
#include "src/runtime/runtime.h"
-#include "src/token.h"
namespace v8 {
@@ -49,11 +49,15 @@ class ApiFunction;
namespace internal {
// Forward declarations.
+class SourcePosition;
class StatsCounter;
// -----------------------------------------------------------------------------
// Platform independent assembler base class.
+enum class CodeObjectRequired { kNo, kYes };
+
+
class AssemblerBase: public Malloced {
public:
AssemblerBase(Isolate* isolate, void* buffer, int buffer_size);
@@ -99,13 +103,13 @@ class AssemblerBase: public Malloced {
// the assembler could clean up internal data structures.
virtual void AbortedCodeGeneration() { }
+ // Debugging
+ void Print();
+
static const int kMinimalBufferSize = 4*KB;
static void FlushICache(Isolate* isolate, void* start, size_t size);
- // TODO(all): Help get rid of this one.
- static void FlushICacheWithoutIsolate(void* start, size_t size);
-
protected:
// The buffer into which code and relocation info are generated. It could
// either be owned by the assembler or be provided externally.
@@ -229,17 +233,18 @@ class CpuFeatures : public AllStatic {
static void PrintTarget();
static void PrintFeatures();
+ private:
+ friend class ExternalReference;
+ friend class AssemblerBase;
// Flush instruction cache.
static void FlushICache(void* start, size_t size);
- private:
// Platform-dependent implementation.
static void ProbeImpl(bool cross_compile);
static unsigned supported_;
static unsigned cache_line_size_;
static bool initialized_;
- friend class ExternalReference;
DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
};
@@ -319,6 +324,8 @@ class Label {
enum SaveFPRegsMode { kDontSaveFPRegs, kSaveFPRegs };
+enum ArgvMode { kArgvOnStack, kArgvInRegister };
+
// Specifies whether to perform icache flush operations on RelocInfo updates.
// If FLUSH_ICACHE_IF_NEEDED, the icache will always be flushed if an
// instruction was modified. If SKIP_ICACHE_FLUSH the flush will always be
@@ -370,7 +377,6 @@ class RelocInfo {
// Please note the order is important (see IsCodeTarget, IsGCRelocMode).
CODE_TARGET, // Code target which is not any of the above.
CODE_TARGET_WITH_ID,
- CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor.
DEBUGGER_STATEMENT, // Code target for the debugger statement.
EMBEDDED_OBJECT,
CELL,
@@ -385,7 +391,6 @@ class RelocInfo {
DEBUG_BREAK_SLOT_AT_POSITION,
DEBUG_BREAK_SLOT_AT_RETURN,
DEBUG_BREAK_SLOT_AT_CALL,
- DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL,
EXTERNAL_REFERENCE, // The address of an external C++ function.
INTERNAL_REFERENCE, // An address inside the same function.
@@ -422,19 +427,19 @@ class RelocInfo {
STATIC_ASSERT(NUMBER_OF_MODES <= kBitsPerInt);
- RelocInfo() {}
+ explicit RelocInfo(Isolate* isolate) : isolate_(isolate) {
+ DCHECK_NOT_NULL(isolate);
+ }
- RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host)
- : pc_(pc), rmode_(rmode), data_(data), host_(host) {
+ RelocInfo(Isolate* isolate, byte* pc, Mode rmode, intptr_t data, Code* host)
+ : isolate_(isolate), pc_(pc), rmode_(rmode), data_(data), host_(host) {
+ DCHECK_NOT_NULL(isolate);
}
static inline bool IsRealRelocMode(Mode mode) {
return mode >= FIRST_REAL_RELOC_MODE &&
mode <= LAST_REAL_RELOC_MODE;
}
- static inline bool IsConstructCall(Mode mode) {
- return mode == CONSTRUCT_CALL;
- }
static inline bool IsCodeTarget(Mode mode) {
return mode <= LAST_CODE_ENUM;
}
@@ -478,8 +483,7 @@ class RelocInfo {
}
static inline bool IsDebugBreakSlot(Mode mode) {
return IsDebugBreakSlotAtPosition(mode) || IsDebugBreakSlotAtReturn(mode) ||
- IsDebugBreakSlotAtCall(mode) ||
- IsDebugBreakSlotAtConstructCall(mode);
+ IsDebugBreakSlotAtCall(mode);
}
static inline bool IsDebugBreakSlotAtPosition(Mode mode) {
return mode == DEBUG_BREAK_SLOT_AT_POSITION;
@@ -490,9 +494,6 @@ class RelocInfo {
static inline bool IsDebugBreakSlotAtCall(Mode mode) {
return mode == DEBUG_BREAK_SLOT_AT_CALL;
}
- static inline bool IsDebugBreakSlotAtConstructCall(Mode mode) {
- return mode == DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL;
- }
static inline bool IsDebuggerStatement(Mode mode) {
return mode == DEBUGGER_STATEMENT;
}
@@ -508,6 +509,7 @@ class RelocInfo {
static inline int ModeMask(Mode mode) { return 1 << mode; }
// Accessors
+ Isolate* isolate() const { return isolate_; }
byte* pc() const { return pc_; }
void set_pc(byte* pc) { pc_ = pc; }
Mode rmode() const { return rmode_; }
@@ -530,9 +532,6 @@ class RelocInfo {
// constant pool, otherwise the pointer is embedded in the instruction stream.
bool IsInConstantPool();
- static int DebugBreakCallArgumentsCount(intptr_t data);
-
- // Read/modify the code target in the branch/call instruction
// this relocation applies to;
// can only be called if IsCodeTarget(rmode_) || IsRuntimeEntry(rmode_)
INLINE(Address target_address());
@@ -615,9 +614,6 @@ class RelocInfo {
template<typename StaticVisitor> inline void Visit(Heap* heap);
inline void Visit(Isolate* isolate, ObjectVisitor* v);
- // Patch the code with a call.
- void PatchCodeWithCall(Address target, int guard_bytes);
-
// Check whether this return sequence has been patched
// with a call to the debugger.
INLINE(bool IsPatchedReturnSequence());
@@ -645,12 +641,13 @@ class RelocInfo {
static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION;
static const int kDataMask =
(1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT);
- static const int kDebugBreakSlotMask =
- 1 << DEBUG_BREAK_SLOT_AT_POSITION | 1 << DEBUG_BREAK_SLOT_AT_RETURN |
- 1 << DEBUG_BREAK_SLOT_AT_CALL | 1 << DEBUG_BREAK_SLOT_AT_CONSTRUCT_CALL;
+ static const int kDebugBreakSlotMask = 1 << DEBUG_BREAK_SLOT_AT_POSITION |
+ 1 << DEBUG_BREAK_SLOT_AT_RETURN |
+ 1 << DEBUG_BREAK_SLOT_AT_CALL;
static const int kApplyMask; // Modes affected by apply. Depends on arch.
private:
+ Isolate* isolate_;
// On ARM, note that pc_ is the address of the constant pool entry
// to be relocated and not the address of the instruction
// referencing the constant pool entry (except when rmode_ ==
@@ -659,11 +656,6 @@ class RelocInfo {
Mode rmode_;
intptr_t data_;
Code* host_;
- // External-reference pointers are also split across instruction-pairs
- // on some platforms, but are accessed via indirect pointers. This location
- // provides a place for that pointer to exist naturally. Its address
- // is returned by RelocInfo::target_reference_address().
- Address reconstructed_adr_ptr_;
friend class RelocIterator;
};
@@ -865,7 +857,8 @@ class ExternalReference BASE_EMBEDDED {
static void InitializeMathExpData();
static void TearDownMathExpData();
- typedef void* ExternalReferenceRedirector(void* original, Type type);
+ typedef void* ExternalReferenceRedirector(Isolate* isolate, void* original,
+ Type type);
ExternalReference() : address_(NULL) {}
@@ -983,19 +976,20 @@ class ExternalReference BASE_EMBEDDED {
static ExternalReference debug_is_active_address(Isolate* isolate);
static ExternalReference debug_after_break_target_address(Isolate* isolate);
- static ExternalReference debug_restarter_frame_function_pointer_address(
- Isolate* isolate);
static ExternalReference is_profiling_address(Isolate* isolate);
static ExternalReference invoke_function_callback(Isolate* isolate);
static ExternalReference invoke_accessor_getter_callback(Isolate* isolate);
- static ExternalReference vector_store_virtual_register(Isolate* isolate);
+ static ExternalReference virtual_handler_register(Isolate* isolate);
+ static ExternalReference virtual_slot_register(Isolate* isolate);
+
+ static ExternalReference runtime_function_table_address(Isolate* isolate);
Address address() const { return reinterpret_cast<Address>(address_); }
// Used to check if single stepping is enabled in generated code.
- static ExternalReference debug_step_in_fp_address(Isolate* isolate);
+ static ExternalReference debug_step_in_enabled_address(Isolate* isolate);
#ifndef V8_INTERPRETED_REGEXP
// C functions called from RegExp generated code.
@@ -1039,9 +1033,8 @@ class ExternalReference BASE_EMBEDDED {
reinterpret_cast<ExternalReferenceRedirector*>(
isolate->external_reference_redirector());
void* address = reinterpret_cast<void*>(address_arg);
- void* answer = (redirector == NULL) ?
- address :
- (*redirector)(address, type);
+ void* answer =
+ (redirector == NULL) ? address : (*redirector)(isolate, address, type);
return answer;
}
@@ -1130,7 +1123,7 @@ inline int NumberOfBitsSet(uint32_t x) {
bool EvalComparison(Token::Value op, double op1, double op2);
// Computes pow(x, y) with the special cases in the spec for Math.pow.
-double power_helper(double x, double y);
+double power_helper(Isolate* isolate, double x, double y);
double power_double_int(double x, int y);
double power_double_double(double x, double y);
@@ -1146,8 +1139,11 @@ class CallWrapper {
virtual void BeforeCall(int call_size) const = 0;
// Called just after emitting a call, i.e., at the return site for the call.
virtual void AfterCall() const = 0;
+ // Return whether call needs to check for debug stepping.
+ virtual bool NeedsDebugStepCheck() const { return false; }
};
+
class NullCallWrapper : public CallWrapper {
public:
NullCallWrapper() { }
@@ -1157,6 +1153,16 @@ class NullCallWrapper : public CallWrapper {
};
+class CheckDebugStepCallWrapper : public CallWrapper {
+ public:
+ CheckDebugStepCallWrapper() {}
+ virtual ~CheckDebugStepCallWrapper() {}
+ virtual void BeforeCall(int call_size) const {}
+ virtual void AfterCall() const {}
+ virtual bool NeedsDebugStepCheck() const { return true; }
+};
+
+
// -----------------------------------------------------------------------------
// Constant pool support
@@ -1276,7 +1282,6 @@ class ConstantPoolBuilder BASE_EMBEDDED {
PerTypeEntryInfo info_[ConstantPoolEntry::NUMBER_OF_TYPES];
};
-
-} } // namespace v8::internal
-
+} // namespace internal
+} // namespace v8
#endif // V8_ASSEMBLER_H_