| Index: src/assembler.h
|
| ===================================================================
|
| --- src/assembler.h (revision 6800)
|
| +++ src/assembler.h (working copy)
|
| @@ -35,6 +35,7 @@
|
| #ifndef V8_ASSEMBLER_H_
|
| #define V8_ASSEMBLER_H_
|
|
|
| +#include "gdb-jit.h"
|
| #include "runtime.h"
|
| #include "top.h"
|
| #include "token.h"
|
| @@ -50,6 +51,7 @@
|
| public:
|
| static const double min_int;
|
| static const double one_half;
|
| + static const double minus_zero;
|
| static const double negative_infinity;
|
| };
|
|
|
| @@ -179,14 +181,19 @@
|
| // invalid/uninitialized position value.
|
| static const int kNoPosition = -1;
|
|
|
| + // This string is used to add padding comments to the reloc info in cases
|
| + // where we are not sure to have enough space for patching in during
|
| + // lazy deoptimization. This is the case if we have indirect calls for which
|
| + // we do not normally record relocation info.
|
| + static const char* kFillerCommentString;
|
| +
|
| enum Mode {
|
| // Please note the order is important (see IsCodeTarget, IsGCRelocMode).
|
| CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor.
|
| - CODE_TARGET_CONTEXT, // Code target used for contextual loads.
|
| + CODE_TARGET_CONTEXT, // Code target used for contextual loads and stores.
|
| DEBUG_BREAK, // Code target for the debugger statement.
|
| CODE_TARGET, // Code target which is not any of the above.
|
| EMBEDDED_OBJECT,
|
| -
|
| GLOBAL_PROPERTY_CELL,
|
|
|
| // Everything after runtime_entry (inclusive) is not GC'ed.
|
| @@ -204,7 +211,7 @@
|
| NUMBER_OF_MODES, // must be no greater than 14 - see RelocInfoWriter
|
| NONE, // never recorded
|
| LAST_CODE_ENUM = CODE_TARGET,
|
| - LAST_GCED_ENUM = EMBEDDED_OBJECT
|
| + LAST_GCED_ENUM = GLOBAL_PROPERTY_CELL
|
| };
|
|
|
|
|
| @@ -461,9 +468,6 @@
|
| #endif
|
|
|
|
|
| -typedef void* ExternalReferenceRedirector(void* original, bool fp_return);
|
| -
|
| -
|
| // An ExternalReference represents a C++ address used in the generated
|
| // code. All references to C++ functions and variables must be encapsulated in
|
| // an ExternalReference instance. This is done in order to track the origin of
|
| @@ -471,9 +475,29 @@
|
| // addresses when deserializing a heap.
|
| class ExternalReference BASE_EMBEDDED {
|
| public:
|
| + // Used in the simulator to support different native api calls.
|
| + //
|
| + // BUILTIN_CALL - builtin call.
|
| + // MaybeObject* f(v8::internal::Arguments).
|
| + //
|
| + // FP_RETURN_CALL - builtin call that returns floating point.
|
| + // double f(double, double).
|
| + //
|
| + // DIRECT_CALL - direct call to API function native callback
|
| + // from generated code.
|
| + // Handle<Value> f(v8::Arguments&)
|
| + //
|
| + enum Type {
|
| + BUILTIN_CALL, // default
|
| + FP_RETURN_CALL,
|
| + DIRECT_CALL
|
| + };
|
| +
|
| + typedef void* ExternalReferenceRedirector(void* original, Type type);
|
| +
|
| explicit ExternalReference(Builtins::CFunctionId id);
|
|
|
| - explicit ExternalReference(ApiFunction* ptr);
|
| + explicit ExternalReference(ApiFunction* ptr, Type type);
|
|
|
| explicit ExternalReference(Builtins::Name name);
|
|
|
| @@ -515,6 +539,9 @@
|
| // Static variable Factory::the_hole_value.location()
|
| static ExternalReference the_hole_value_location();
|
|
|
| + // Static variable Factory::arguments_marker.location()
|
| + static ExternalReference arguments_marker_location();
|
| +
|
| // Static variable Heap::roots_address()
|
| static ExternalReference roots_address();
|
|
|
| @@ -558,6 +585,7 @@
|
| // Static variables containing common double constants.
|
| static ExternalReference address_of_min_int();
|
| static ExternalReference address_of_one_half();
|
| + static ExternalReference address_of_minus_zero();
|
| static ExternalReference address_of_negative_infinity();
|
|
|
| Address address() const {return reinterpret_cast<Address>(address_);}
|
| @@ -600,17 +628,19 @@
|
|
|
| static ExternalReferenceRedirector* redirector_;
|
|
|
| - static void* Redirect(void* address, bool fp_return = false) {
|
| + static void* Redirect(void* address,
|
| + Type type = ExternalReference::BUILTIN_CALL) {
|
| if (redirector_ == NULL) return address;
|
| - void* answer = (*redirector_)(address, fp_return);
|
| + void* answer = (*redirector_)(address, type);
|
| return answer;
|
| }
|
|
|
| - static void* Redirect(Address address_arg, bool fp_return = false) {
|
| + static void* Redirect(Address address_arg,
|
| + Type type = ExternalReference::BUILTIN_CALL) {
|
| void* address = reinterpret_cast<void*>(address_arg);
|
| void* answer = (redirector_ == NULL) ?
|
| address :
|
| - (*redirector_)(address, fp_return);
|
| + (*redirector_)(address, type);
|
| return answer;
|
| }
|
|
|
| @@ -638,8 +668,30 @@
|
| class PositionsRecorder BASE_EMBEDDED {
|
| public:
|
| explicit PositionsRecorder(Assembler* assembler)
|
| - : assembler_(assembler) {}
|
| + : assembler_(assembler) {
|
| +#ifdef ENABLE_GDB_JIT_INTERFACE
|
| + gdbjit_lineinfo_ = NULL;
|
| +#endif
|
| + }
|
|
|
| +#ifdef ENABLE_GDB_JIT_INTERFACE
|
| + ~PositionsRecorder() {
|
| + delete gdbjit_lineinfo_;
|
| + }
|
| +
|
| + void StartGDBJITLineInfoRecording() {
|
| + if (FLAG_gdbjit) {
|
| + gdbjit_lineinfo_ = new GDBJITLineInfo();
|
| + }
|
| + }
|
| +
|
| + GDBJITLineInfo* DetachGDBJITLineInfo() {
|
| + GDBJITLineInfo* lineinfo = gdbjit_lineinfo_;
|
| + gdbjit_lineinfo_ = NULL; // To prevent deallocation in destructor.
|
| + return lineinfo;
|
| + }
|
| +#endif
|
| +
|
| // Set current position to pos.
|
| void RecordPosition(int pos);
|
|
|
| @@ -658,6 +710,9 @@
|
| private:
|
| Assembler* assembler_;
|
| PositionState state_;
|
| +#ifdef ENABLE_GDB_JIT_INTERFACE
|
| + GDBJITLineInfo* gdbjit_lineinfo_;
|
| +#endif
|
|
|
| friend class PreservePositionScope;
|
|
|
|
|