Commit d96dc075 authored by whesse@chromium.org's avatar whesse@chromium.org

Add AST ID to RelocInfo for type-recording ICs. Changes 7644 and 7632, combined.

BUG=
TEST=

Review URL: http://codereview.chromium.org/6902066

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@7694 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 7ba01a83
...@@ -315,6 +315,7 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) ...@@ -315,6 +315,7 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
no_const_pool_before_ = 0; no_const_pool_before_ = 0;
last_const_pool_end_ = 0; last_const_pool_end_ = 0;
last_bound_pos_ = 0; last_bound_pos_ = 0;
ast_id_for_reloc_info_ = kNoASTId;
} }
...@@ -2722,8 +2723,15 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { ...@@ -2722,8 +2723,15 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) {
} }
} }
ASSERT(buffer_space() >= kMaxRelocSize); // too late to grow buffer here ASSERT(buffer_space() >= kMaxRelocSize); // too late to grow buffer here
if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
ASSERT(ast_id_for_reloc_info_ != kNoASTId);
RelocInfo reloc_info_with_ast_id(pc_, rmode, ast_id_for_reloc_info_);
ast_id_for_reloc_info_ = kNoASTId;
reloc_info_writer.Write(&reloc_info_with_ast_id);
} else {
reloc_info_writer.Write(&rinfo); reloc_info_writer.Write(&rinfo);
} }
}
} }
......
...@@ -1167,6 +1167,10 @@ class Assembler : public AssemblerBase { ...@@ -1167,6 +1167,10 @@ class Assembler : public AssemblerBase {
// Mark address of a debug break slot. // Mark address of a debug break slot.
void RecordDebugBreakSlot(); void RecordDebugBreakSlot();
// Record the AST id of the CallIC being compiled, so that it can be placed
// in the relocation information.
void RecordAstId(unsigned ast_id) { ast_id_for_reloc_info_ = ast_id; }
// Record a comment relocation entry that can be used by a disassembler. // Record a comment relocation entry that can be used by a disassembler.
// Use --code-comments to enable. // Use --code-comments to enable.
void RecordComment(const char* msg); void RecordComment(const char* msg);
...@@ -1224,6 +1228,11 @@ class Assembler : public AssemblerBase { ...@@ -1224,6 +1228,11 @@ class Assembler : public AssemblerBase {
void CheckConstPool(bool force_emit, bool require_jump); void CheckConstPool(bool force_emit, bool require_jump);
protected: protected:
// Relocation for a type-recording IC has the AST id added to it. This
// member variable is a way to pass the information from the call site to
// the relocation info.
unsigned ast_id_for_reloc_info_;
bool emit_debug_code() const { return emit_debug_code_; } bool emit_debug_code() const { return emit_debug_code_; }
int buffer_space() const { return reloc_info_writer.pos() - pc_; } int buffer_space() const { return reloc_info_writer.pos() - pc_; }
......
This diff is collapsed.
...@@ -148,8 +148,9 @@ int MacroAssembler::CallSize( ...@@ -148,8 +148,9 @@ int MacroAssembler::CallSize(
} }
void MacroAssembler::Call( void MacroAssembler::Call(intptr_t target,
intptr_t target, RelocInfo::Mode rmode, Condition cond) { RelocInfo::Mode rmode,
Condition cond) {
// Block constant pool for the call instruction sequence. // Block constant pool for the call instruction sequence.
BlockConstPoolScope block_const_pool(this); BlockConstPoolScope block_const_pool(this);
#ifdef DEBUG #ifdef DEBUG
...@@ -214,8 +215,31 @@ int MacroAssembler::CallSize( ...@@ -214,8 +215,31 @@ int MacroAssembler::CallSize(
} }
void MacroAssembler::Call( void MacroAssembler::CallWithAstId(Handle<Code> code,
Handle<Code> code, RelocInfo::Mode rmode, Condition cond) { RelocInfo::Mode rmode,
unsigned ast_id,
Condition cond) {
#ifdef DEBUG
int pre_position = pc_offset();
#endif
ASSERT(rmode == RelocInfo::CODE_TARGET_WITH_ID);
ASSERT(ast_id != kNoASTId);
ASSERT(ast_id_for_reloc_info_ == kNoASTId);
ast_id_for_reloc_info_ = ast_id;
// 'code' is always generated ARM code, never THUMB code
Call(reinterpret_cast<intptr_t>(code.location()), rmode, cond);
#ifdef DEBUG
int post_position = pc_offset();
CHECK_EQ(pre_position + CallSize(code, rmode, cond), post_position);
#endif
}
void MacroAssembler::Call(Handle<Code> code,
RelocInfo::Mode rmode,
Condition cond) {
#ifdef DEBUG #ifdef DEBUG
int pre_position = pc_offset(); int pre_position = pc_offset();
#endif #endif
......
...@@ -105,7 +105,13 @@ class MacroAssembler: public Assembler { ...@@ -105,7 +105,13 @@ class MacroAssembler: public Assembler {
int CallSize(byte* target, RelocInfo::Mode rmode, Condition cond = al); int CallSize(byte* target, RelocInfo::Mode rmode, Condition cond = al);
void Call(byte* target, RelocInfo::Mode rmode, Condition cond = al); void Call(byte* target, RelocInfo::Mode rmode, Condition cond = al);
int CallSize(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); int CallSize(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al);
void Call(Handle<Code> code, RelocInfo::Mode rmode, Condition cond = al); void Call(Handle<Code> code,
RelocInfo::Mode rmode,
Condition cond = al);
void CallWithAstId(Handle<Code> code,
RelocInfo::Mode rmode,
unsigned ast_id,
Condition cond = al);
void Ret(Condition cond = al); void Ret(Condition cond = al);
// Emit code to discard a non-negative number of pointer-sized elements // Emit code to discard a non-negative number of pointer-sized elements
...@@ -985,7 +991,9 @@ class MacroAssembler: public Assembler { ...@@ -985,7 +991,9 @@ class MacroAssembler: public Assembler {
void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); void Jump(intptr_t target, RelocInfo::Mode rmode, Condition cond = al);
int CallSize(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); int CallSize(intptr_t target, RelocInfo::Mode rmode, Condition cond = al);
void Call(intptr_t target, RelocInfo::Mode rmode, Condition cond = al); void Call(intptr_t target,
RelocInfo::Mode rmode,
Condition cond = al);
// Helper functions for generating invokes. // Helper functions for generating invokes.
void InvokePrologue(const ParameterCount& expected, void InvokePrologue(const ParameterCount& expected,
......
This diff is collapsed.
...@@ -42,7 +42,7 @@ ...@@ -42,7 +42,7 @@
namespace v8 { namespace v8 {
namespace internal { namespace internal {
const unsigned kNoASTId = -1;
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Platform independent assembler base class. // Platform independent assembler base class.
...@@ -209,10 +209,11 @@ class RelocInfo BASE_EMBEDDED { ...@@ -209,10 +209,11 @@ class RelocInfo BASE_EMBEDDED {
enum Mode { enum Mode {
// Please note the order is important (see IsCodeTarget, IsGCRelocMode). // 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. CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor.
CODE_TARGET_CONTEXT, // Code target used for contextual loads and stores. CODE_TARGET_CONTEXT, // Code target used for contextual loads and stores.
DEBUG_BREAK, // Code target for the debugger statement. DEBUG_BREAK, // Code target for the debugger statement.
CODE_TARGET, // Code target which is not any of the above.
EMBEDDED_OBJECT, EMBEDDED_OBJECT,
GLOBAL_PROPERTY_CELL, GLOBAL_PROPERTY_CELL,
...@@ -228,10 +229,12 @@ class RelocInfo BASE_EMBEDDED { ...@@ -228,10 +229,12 @@ class RelocInfo BASE_EMBEDDED {
// add more as needed // add more as needed
// Pseudo-types // Pseudo-types
NUMBER_OF_MODES, // must be no greater than 14 - see RelocInfoWriter NUMBER_OF_MODES, // There are at most 14 modes with noncompact encoding.
NONE, // never recorded NONE, // never recorded
LAST_CODE_ENUM = CODE_TARGET, LAST_CODE_ENUM = DEBUG_BREAK,
LAST_GCED_ENUM = GLOBAL_PROPERTY_CELL LAST_GCED_ENUM = GLOBAL_PROPERTY_CELL,
// Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding.
LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID
}; };
...@@ -361,7 +364,8 @@ class RelocInfo BASE_EMBEDDED { ...@@ -361,7 +364,8 @@ class RelocInfo BASE_EMBEDDED {
static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1; static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1;
static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION; static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION;
static const int kDebugMask = kPositionMask | 1 << COMMENT; static const int kDataMask =
(1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT);
static const int kApplyMask; // Modes affected by apply. Depends on arch. static const int kApplyMask; // Modes affected by apply. Depends on arch.
private: private:
...@@ -380,9 +384,14 @@ class RelocInfo BASE_EMBEDDED { ...@@ -380,9 +384,14 @@ class RelocInfo BASE_EMBEDDED {
// lower addresses. // lower addresses.
class RelocInfoWriter BASE_EMBEDDED { class RelocInfoWriter BASE_EMBEDDED {
public: public:
RelocInfoWriter() : pos_(NULL), last_pc_(NULL), last_data_(0) {} RelocInfoWriter() : pos_(NULL),
RelocInfoWriter(byte* pos, byte* pc) : pos_(pos), last_pc_(pc), last_pc_(NULL),
last_data_(0) {} last_id_(0),
last_position_(0) {}
RelocInfoWriter(byte* pos, byte* pc) : pos_(pos),
last_pc_(pc),
last_id_(0),
last_position_(0) {}
byte* pos() const { return pos_; } byte* pos() const { return pos_; }
byte* last_pc() const { return last_pc_; } byte* last_pc() const { return last_pc_; }
...@@ -407,13 +416,15 @@ class RelocInfoWriter BASE_EMBEDDED { ...@@ -407,13 +416,15 @@ class RelocInfoWriter BASE_EMBEDDED {
inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta); inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta);
inline void WriteTaggedPC(uint32_t pc_delta, int tag); inline void WriteTaggedPC(uint32_t pc_delta, int tag);
inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag); inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag);
inline void WriteExtraTaggedIntData(int data_delta, int top_tag);
inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag); inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag);
inline void WriteTaggedData(intptr_t data_delta, int tag); inline void WriteTaggedData(intptr_t data_delta, int tag);
inline void WriteExtraTag(int extra_tag, int top_tag); inline void WriteExtraTag(int extra_tag, int top_tag);
byte* pos_; byte* pos_;
byte* last_pc_; byte* last_pc_;
intptr_t last_data_; int last_id_;
int last_position_;
DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter); DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter);
}; };
...@@ -455,12 +466,13 @@ class RelocIterator: public Malloced { ...@@ -455,12 +466,13 @@ class RelocIterator: public Malloced {
int GetTopTag(); int GetTopTag();
void ReadTaggedPC(); void ReadTaggedPC();
void AdvanceReadPC(); void AdvanceReadPC();
void AdvanceReadId();
void AdvanceReadPosition();
void AdvanceReadData(); void AdvanceReadData();
void AdvanceReadVariableLengthPCJump(); void AdvanceReadVariableLengthPCJump();
int GetPositionTypeTag(); int GetLocatableTypeTag();
void ReadTaggedData(); void ReadTaggedId();
void ReadTaggedPosition();
static RelocInfo::Mode DebugInfoModeFromTag(int tag);
// If the given mode is wanted, set it in rinfo_ and return true. // If the given mode is wanted, set it in rinfo_ and return true.
// Else return false. Used for efficiently skipping unwanted modes. // Else return false. Used for efficiently skipping unwanted modes.
...@@ -473,6 +485,8 @@ class RelocIterator: public Malloced { ...@@ -473,6 +485,8 @@ class RelocIterator: public Malloced {
RelocInfo rinfo_; RelocInfo rinfo_;
bool done_; bool done_;
int mode_mask_; int mode_mask_;
int last_id_;
int last_position_;
DISALLOW_COPY_AND_ASSIGN(RelocIterator); DISALLOW_COPY_AND_ASSIGN(RelocIterator);
}; };
......
...@@ -1147,6 +1147,7 @@ CaseClause::CaseClause(Expression* label, ...@@ -1147,6 +1147,7 @@ CaseClause::CaseClause(Expression* label,
statements_(statements), statements_(statements),
position_(pos), position_(pos),
compare_type_(NONE), compare_type_(NONE),
compare_id_(AstNode::GetNextId()),
entry_id_(AstNode::GetNextId()) { entry_id_(AstNode::GetNextId()) {
} }
......
...@@ -661,6 +661,7 @@ class CaseClause: public ZoneObject { ...@@ -661,6 +661,7 @@ class CaseClause: public ZoneObject {
void set_position(int pos) { position_ = pos; } void set_position(int pos) { position_ = pos; }
int EntryId() { return entry_id_; } int EntryId() { return entry_id_; }
int CompareId() { return compare_id_; }
// Type feedback information. // Type feedback information.
void RecordTypeFeedback(TypeFeedbackOracle* oracle); void RecordTypeFeedback(TypeFeedbackOracle* oracle);
...@@ -674,6 +675,7 @@ class CaseClause: public ZoneObject { ...@@ -674,6 +675,7 @@ class CaseClause: public ZoneObject {
int position_; int position_;
enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY }; enum CompareTypeFeedback { NONE, SMI_ONLY, OBJECT_ONLY };
CompareTypeFeedback compare_type_; CompareTypeFeedback compare_type_;
int compare_id_;
int entry_id_; int entry_id_;
}; };
......
...@@ -282,6 +282,9 @@ static int DecodeIt(FILE* f, ...@@ -282,6 +282,9 @@ static int DecodeIt(FILE* f,
} else { } else {
out.AddFormatted(" %s", Code::Kind2String(kind)); out.AddFormatted(" %s", Code::Kind2String(kind));
} }
if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
out.AddFormatted(" (id = %d)", static_cast<int>(relocinfo.data()));
}
} else if (rmode == RelocInfo::RUNTIME_ENTRY && } else if (rmode == RelocInfo::RUNTIME_ENTRY &&
Isolate::Current()->deoptimizer_data() != NULL) { Isolate::Current()->deoptimizer_data() != NULL) {
// A runtime entry reloinfo might be a deoptimization bailout. // A runtime entry reloinfo might be a deoptimization bailout.
......
...@@ -744,7 +744,7 @@ void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) { ...@@ -744,7 +744,7 @@ void FullCodeGenerator::VisitBinaryOperation(BinaryOperation* expr) {
if (ShouldInlineSmiCase(op)) { if (ShouldInlineSmiCase(op)) {
EmitInlineSmiBinaryOp(expr, op, mode, left, right); EmitInlineSmiBinaryOp(expr, op, mode, left, right);
} else { } else {
EmitBinaryOp(op, mode); EmitBinaryOp(expr, op, mode);
} }
break; break;
} }
......
// Copyright 2010 the V8 project authors. All rights reserved. // Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without // Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are // modification, are permitted provided that the following conditions are
// met: // met:
...@@ -445,12 +445,13 @@ class FullCodeGenerator: public AstVisitor { ...@@ -445,12 +445,13 @@ class FullCodeGenerator: public AstVisitor {
// Apply the compound assignment operator. Expects the left operand on top // Apply the compound assignment operator. Expects the left operand on top
// of the stack and the right one in the accumulator. // of the stack and the right one in the accumulator.
void EmitBinaryOp(Token::Value op, void EmitBinaryOp(BinaryOperation* expr,
Token::Value op,
OverwriteMode mode); OverwriteMode mode);
// Helper functions for generating inlined smi code for certain // Helper functions for generating inlined smi code for certain
// binary operations. // binary operations.
void EmitInlineSmiBinaryOp(Expression* expr, void EmitInlineSmiBinaryOp(BinaryOperation* expr,
Token::Value op, Token::Value op,
OverwriteMode mode, OverwriteMode mode,
Expression* left, Expression* left,
...@@ -512,12 +513,16 @@ class FullCodeGenerator: public AstVisitor { ...@@ -512,12 +513,16 @@ class FullCodeGenerator: public AstVisitor {
static Register context_register(); static Register context_register();
// Helper for calling an IC stub. // Helper for calling an IC stub.
void EmitCallIC(Handle<Code> ic, RelocInfo::Mode mode); void EmitCallIC(Handle<Code> ic,
RelocInfo::Mode mode,
unsigned ast_id);
// Calling an IC stub with a patch site. Passing NULL for patch_site // Calling an IC stub with a patch site. Passing NULL for patch_site
// or non NULL patch_site which is not activated indicates no inlined smi code // or non NULL patch_site which is not activated indicates no inlined smi code
// and emits a nop after the IC call. // and emits a nop after the IC call.
void EmitCallIC(Handle<Code> ic, JumpPatchSite* patch_site); void EmitCallIC(Handle<Code> ic,
JumpPatchSite* patch_site,
unsigned ast_id);
// Set fields in the stack frame. Offsets are the frame pointer relative // Set fields in the stack frame. Offsets are the frame pointer relative
// offsets defined in, e.g., StandardFrameConstants. // offsets defined in, e.g., StandardFrameConstants.
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
// The original source code covered by the above license above has been // The original source code covered by the above license above has been
// modified significantly by Google Inc. // modified significantly by Google Inc.
// Copyright 2006-2008 the V8 project authors. All rights reserved. // Copyright 2011 the V8 project authors. All rights reserved.
// A light-weight IA32 Assembler. // A light-weight IA32 Assembler.
...@@ -311,8 +311,12 @@ void Assembler::emit(Handle<Object> handle) { ...@@ -311,8 +311,12 @@ void Assembler::emit(Handle<Object> handle) {
} }
void Assembler::emit(uint32_t x, RelocInfo::Mode rmode) { void Assembler::emit(uint32_t x, RelocInfo::Mode rmode, unsigned id) {
if (rmode != RelocInfo::NONE) RecordRelocInfo(rmode); if (rmode == RelocInfo::CODE_TARGET && id != kNoASTId) {
RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, static_cast<intptr_t>(id));
} else if (rmode != RelocInfo::NONE) {
RecordRelocInfo(rmode);
}
emit(x); emit(x);
} }
......
...@@ -1589,13 +1589,15 @@ void Assembler::call(const Operand& adr) { ...@@ -1589,13 +1589,15 @@ void Assembler::call(const Operand& adr) {
} }
void Assembler::call(Handle<Code> code, RelocInfo::Mode rmode) { void Assembler::call(Handle<Code> code,
RelocInfo::Mode rmode,
unsigned ast_id) {
positions_recorder()->WriteRecordedPositions(); positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this); EnsureSpace ensure_space(this);
last_pc_ = pc_; last_pc_ = pc_;
ASSERT(RelocInfo::IsCodeTarget(rmode)); ASSERT(RelocInfo::IsCodeTarget(rmode));
EMIT(0xE8); EMIT(0xE8);
emit(reinterpret_cast<intptr_t>(code.location()), rmode); emit(reinterpret_cast<intptr_t>(code.location()), rmode, ast_id);
} }
......
...@@ -848,7 +848,9 @@ class Assembler : public AssemblerBase { ...@@ -848,7 +848,9 @@ class Assembler : public AssemblerBase {
void call(Label* L); void call(Label* L);
void call(byte* entry, RelocInfo::Mode rmode); void call(byte* entry, RelocInfo::Mode rmode);
void call(const Operand& adr); void call(const Operand& adr);
void call(Handle<Code> code, RelocInfo::Mode rmode); void call(Handle<Code> code,
RelocInfo::Mode rmode,
unsigned ast_id = kNoASTId);
// Jumps // Jumps
void jmp(Label* L); // unconditional jump to L void jmp(Label* L); // unconditional jump to L
...@@ -1070,7 +1072,9 @@ class Assembler : public AssemblerBase { ...@@ -1070,7 +1072,9 @@ class Assembler : public AssemblerBase {
void GrowBuffer(); void GrowBuffer();
inline void emit(uint32_t x); inline void emit(uint32_t x);
inline void emit(Handle<Object> handle); inline void emit(Handle<Object> handle);
inline void emit(uint32_t x, RelocInfo::Mode rmode); inline void emit(uint32_t x,
RelocInfo::Mode rmode,
unsigned ast_id = kNoASTId);
inline void emit(const Immediate& x); inline void emit(const Immediate& x);
inline void emit_w(const Immediate& x); inline void emit_w(const Immediate& x);
......
This diff is collapsed.
...@@ -1104,9 +1104,9 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, ...@@ -1104,9 +1104,9 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
} }
void MacroAssembler::CallStub(CodeStub* stub) { void MacroAssembler::CallStub(CodeStub* stub, unsigned ast_id) {
ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs. ASSERT(allow_stub_calls()); // Calls are not allowed in some stubs.
call(stub->GetCode(), RelocInfo::CODE_TARGET); call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id);
} }
......
...@@ -452,7 +452,7 @@ class MacroAssembler: public Assembler { ...@@ -452,7 +452,7 @@ class MacroAssembler: public Assembler {
// Runtime calls // Runtime calls
// Call a code stub. Generate the code if necessary. // Call a code stub. Generate the code if necessary.
void CallStub(CodeStub* stub); void CallStub(CodeStub* stub, unsigned ast_id = kNoASTId);
// Call a code stub and return the code object called. Try to generate // Call a code stub and return the code object called. Try to generate
// the code if necessary. Do not perform a GC but instead return a retry // the code if necessary. Do not perform a GC but instead return a retry
......
This diff is collapsed.
...@@ -36,18 +36,18 @@ namespace v8 { ...@@ -36,18 +36,18 @@ namespace v8 {
namespace internal { namespace internal {
// Unknown // Unknown
// | \____________
// | | // | |
// | \--------------|
// Primitive Non-primitive // Primitive Non-primitive
// | \--------| | // | \_______ |
// | | |
// Number String | // Number String |
// / | | | // / \ | |
// Double Integer32 | / // Double Integer32 | /
// | | / / // | | / /
// | Smi / / // | Smi / /
// | | / / // | | / __/
// | | / / // Uninitialized.
// Uninitialized.--/
class TypeInfo { class TypeInfo {
public: public:
...@@ -263,21 +263,21 @@ class TypeFeedbackOracle BASE_EMBEDDED { ...@@ -263,21 +263,21 @@ class TypeFeedbackOracle BASE_EMBEDDED {
TypeInfo SwitchType(CaseClause* clause); TypeInfo SwitchType(CaseClause* clause);
private: private:
ZoneMapList* CollectReceiverTypes(int position, ZoneMapList* CollectReceiverTypes(unsigned ast_id,
Handle<String> name, Handle<String> name,
Code::Flags flags); Code::Flags flags);
void SetInfo(int position, Object* target); void SetInfo(unsigned ast_id, Object* target);
void PopulateMap(Handle<Code> code); void PopulateMap(Handle<Code> code);
void CollectPositions(Code* code, void CollectIds(Code* code,
List<int>* code_positions, List<int>* code_positions,
List<int>* source_positions); List<unsigned>* ast_ids);
// Returns an element from the backing store. Returns undefined if // Returns an element from the backing store. Returns undefined if
// there is no information. // there is no information.
Handle<Object> GetInfo(int pos); Handle<Object> GetInfo(unsigned ast_id);
Handle<Context> global_context_; Handle<Context> global_context_;
Handle<NumberDictionary> dictionary_; Handle<NumberDictionary> dictionary_;
......
...@@ -61,9 +61,15 @@ void Assembler::emitw(uint16_t x) { ...@@ -61,9 +61,15 @@ void Assembler::emitw(uint16_t x) {
} }
void Assembler::emit_code_target(Handle<Code> target, RelocInfo::Mode rmode) { void Assembler::emit_code_target(Handle<Code> target,
RelocInfo::Mode rmode,
unsigned ast_id) {
ASSERT(RelocInfo::IsCodeTarget(rmode)); ASSERT(RelocInfo::IsCodeTarget(rmode));
if (rmode == RelocInfo::CODE_TARGET && ast_id != kNoASTId) {
RecordRelocInfo(RelocInfo::CODE_TARGET_WITH_ID, ast_id);
} else {
RecordRelocInfo(rmode); RecordRelocInfo(rmode);
}
int current = code_targets_.length(); int current = code_targets_.length();
if (current > 0 && code_targets_.last().is_identical_to(target)) { if (current > 0 && code_targets_.last().is_identical_to(target)) {
// Optimization if we keep jumping to the same code target. // Optimization if we keep jumping to the same code target.
......
...@@ -869,12 +869,14 @@ void Assembler::call(Label* L) { ...@@ -869,12 +869,14 @@ void Assembler::call(Label* L) {
} }
void Assembler::call(Handle<Code> target, RelocInfo::Mode rmode) { void Assembler::call(Handle<Code> target,
RelocInfo::Mode rmode,
unsigned ast_id) {
positions_recorder()->WriteRecordedPositions(); positions_recorder()->WriteRecordedPositions();
EnsureSpace ensure_space(this); EnsureSpace ensure_space(this);
// 1110 1000 #32-bit disp. // 1110 1000 #32-bit disp.
emit(0xE8); emit(0xE8);
emit_code_target(target, rmode); emit_code_target(target, rmode, ast_id);
} }
......
...@@ -1183,7 +1183,9 @@ class Assembler : public AssemblerBase { ...@@ -1183,7 +1183,9 @@ class Assembler : public AssemblerBase {
// Calls // Calls
// Call near relative 32-bit displacement, relative to next instruction. // Call near relative 32-bit displacement, relative to next instruction.
void call(Label* L); void call(Label* L);
void call(Handle<Code> target, RelocInfo::Mode rmode); void call(Handle<Code> target,
RelocInfo::Mode rmode,
unsigned ast_id = kNoASTId);
// Calls directly to the given address using a relative offset. // Calls directly to the given address using a relative offset.
// Should only ever be used in Code objects for calls within the // Should only ever be used in Code objects for calls within the
...@@ -1427,7 +1429,9 @@ class Assembler : public AssemblerBase { ...@@ -1427,7 +1429,9 @@ class Assembler : public AssemblerBase {
inline void emitl(uint32_t x); inline void emitl(uint32_t x);
inline void emitq(uint64_t x, RelocInfo::Mode rmode); inline void emitq(uint64_t x, RelocInfo::Mode rmode);
inline void emitw(uint16_t x); inline void emitw(uint16_t x);
inline void emit_code_target(Handle<Code> target, RelocInfo::Mode rmode); inline void emit_code_target(Handle<Code> target,
RelocInfo::Mode rmode,
unsigned ast_id = kNoASTId);
void emit(Immediate x) { emitl(x.value_); } void emit(Immediate x) { emitl(x.value_); }
// Emits a REX prefix that encodes a 64-bit operand size and // Emits a REX prefix that encodes a 64-bit operand size and
......
This diff is collapsed.
...@@ -425,9 +425,9 @@ void MacroAssembler::Abort(const char* msg) { ...@@ -425,9 +425,9 @@ void MacroAssembler::Abort(const char* msg) {
} }
void MacroAssembler::CallStub(CodeStub* stub) { void MacroAssembler::CallStub(CodeStub* stub, unsigned ast_id) {
ASSERT(allow_stub_calls()); // calls are not allowed in some stubs ASSERT(allow_stub_calls()); // calls are not allowed in some stubs
Call(stub->GetCode(), RelocInfo::CODE_TARGET); Call(stub->GetCode(), RelocInfo::CODE_TARGET, ast_id);
} }
...@@ -1610,12 +1610,14 @@ void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) { ...@@ -1610,12 +1610,14 @@ void MacroAssembler::Call(Address destination, RelocInfo::Mode rmode) {
} }
void MacroAssembler::Call(Handle<Code> code_object, RelocInfo::Mode rmode) { void MacroAssembler::Call(Handle<Code> code_object,
RelocInfo::Mode rmode,
unsigned ast_id) {
#ifdef DEBUG #ifdef DEBUG
int end_position = pc_offset() + CallSize(code_object); int end_position = pc_offset() + CallSize(code_object);
#endif #endif
ASSERT(RelocInfo::IsCodeTarget(rmode)); ASSERT(RelocInfo::IsCodeTarget(rmode));
call(code_object, rmode); call(code_object, rmode, ast_id);
#ifdef DEBUG #ifdef DEBUG
CHECK_EQ(end_position, pc_offset()); CHECK_EQ(end_position, pc_offset());
#endif #endif
......
...@@ -692,7 +692,9 @@ class MacroAssembler: public Assembler { ...@@ -692,7 +692,9 @@ class MacroAssembler: public Assembler {
void Call(Address destination, RelocInfo::Mode rmode); void Call(Address destination, RelocInfo::Mode rmode);
void Call(ExternalReference ext); void Call(ExternalReference ext);
void Call(Handle<Code> code_object, RelocInfo::Mode rmode); void Call(Handle<Code> code_object,
RelocInfo::Mode rmode,
unsigned ast_id = kNoASTId);
// The size of the code generated for different call instructions. // The size of the code generated for different call instructions.
int CallSize(Address destination, RelocInfo::Mode rmode) { int CallSize(Address destination, RelocInfo::Mode rmode) {
...@@ -932,7 +934,7 @@ class MacroAssembler: public Assembler { ...@@ -932,7 +934,7 @@ class MacroAssembler: public Assembler {
// Runtime calls // Runtime calls
// Call a code stub. // Call a code stub.
void CallStub(CodeStub* stub); void CallStub(CodeStub* stub, unsigned ast_id = kNoASTId);
// Call a code stub and return the code object called. Try to generate // Call a code stub and return the code object called. Try to generate
// the code if necessary. Do not perform a GC but instead return a retry // the code if necessary. Do not perform a GC but instead return a retry
......
...@@ -501,7 +501,11 @@ void CheckDebugBreakFunction(DebugLocalContext* env, ...@@ -501,7 +501,11 @@ void CheckDebugBreakFunction(DebugLocalContext* env,
CHECK(Debug::HasDebugInfo(shared)); CHECK(Debug::HasDebugInfo(shared));
TestBreakLocationIterator it1(Debug::GetDebugInfo(shared)); TestBreakLocationIterator it1(Debug::GetDebugInfo(shared));
it1.FindBreakLocationFromPosition(position); it1.FindBreakLocationFromPosition(position);
CHECK_EQ(mode, it1.it()->rinfo()->rmode()); v8::internal::RelocInfo::Mode actual_mode = it1.it()->rinfo()->rmode();
if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) {
actual_mode = v8::internal::RelocInfo::CODE_TARGET;
}
CHECK_EQ(mode, actual_mode);
if (mode != v8::internal::RelocInfo::JS_RETURN) { if (mode != v8::internal::RelocInfo::JS_RETURN) {
CHECK_EQ(debug_break, CHECK_EQ(debug_break,
Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address())); Code::GetCodeFromTargetAddress(it1.it()->rinfo()->target_address()));
...@@ -516,7 +520,11 @@ void CheckDebugBreakFunction(DebugLocalContext* env, ...@@ -516,7 +520,11 @@ void CheckDebugBreakFunction(DebugLocalContext* env,
CHECK(debug->EnsureDebugInfo(shared)); CHECK(debug->EnsureDebugInfo(shared));
TestBreakLocationIterator it2(Debug::GetDebugInfo(shared)); TestBreakLocationIterator it2(Debug::GetDebugInfo(shared));
it2.FindBreakLocationFromPosition(position); it2.FindBreakLocationFromPosition(position);
CHECK_EQ(mode, it2.it()->rinfo()->rmode()); actual_mode = it2.it()->rinfo()->rmode();
if (actual_mode == v8::internal::RelocInfo::CODE_TARGET_WITH_ID) {
actual_mode = v8::internal::RelocInfo::CODE_TARGET;
}
CHECK_EQ(mode, actual_mode);
if (mode == v8::internal::RelocInfo::JS_RETURN) { if (mode == v8::internal::RelocInfo::JS_RETURN) {
CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo())); CHECK(!Debug::IsDebugBreakAtReturn(it2.it()->rinfo()));
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment