Fixed confusion between AST IDs and condition codes on ARM.

C++'s 'great' idea of implicitly converting an enum to an integral value hit us
again, this time resulting in silly (but currently non-harmful) entries in the
relocation table. Encapsulated the AST ID recording a bit, which helped a lot to
find the culprit.
Review URL: http://codereview.chromium.org/7400016

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@8671 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ec9ae871
...@@ -326,7 +326,7 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size) ...@@ -326,7 +326,7 @@ Assembler::Assembler(Isolate* arg_isolate, void* buffer, int buffer_size)
no_const_pool_before_ = 0; no_const_pool_before_ = 0;
first_const_pool_use_ = -1; first_const_pool_use_ = -1;
last_bound_pos_ = 0; last_bound_pos_ = 0;
ast_id_for_reloc_info_ = kNoASTId; ClearRecordedAstId();
} }
...@@ -2537,9 +2537,8 @@ void Assembler::RecordRelocInfo(RelocInfo::Mode rmode, intptr_t data) { ...@@ -2537,9 +2537,8 @@ 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) { if (rmode == RelocInfo::CODE_TARGET_WITH_ID) {
ASSERT(ast_id_for_reloc_info_ != kNoASTId); RelocInfo reloc_info_with_ast_id(pc_, rmode, RecordedAstId());
RelocInfo reloc_info_with_ast_id(pc_, rmode, ast_id_for_reloc_info_); ClearRecordedAstId();
ast_id_for_reloc_info_ = kNoASTId;
reloc_info_writer.Write(&reloc_info_with_ast_id); reloc_info_writer.Write(&reloc_info_with_ast_id);
} else { } else {
reloc_info_writer.Write(&rinfo); reloc_info_writer.Write(&rinfo);
......
...@@ -1178,7 +1178,17 @@ class Assembler : public AssemblerBase { ...@@ -1178,7 +1178,17 @@ class Assembler : public AssemblerBase {
// Record the AST id of the CallIC being compiled, so that it can be placed // Record the AST id of the CallIC being compiled, so that it can be placed
// in the relocation information. // in the relocation information.
void RecordAstId(unsigned ast_id) { ast_id_for_reloc_info_ = ast_id; } void SetRecordedAstId(unsigned ast_id) {
ASSERT(recorded_ast_id_ == kNoASTId);
recorded_ast_id_ = ast_id;
}
unsigned RecordedAstId() {
ASSERT(recorded_ast_id_ != kNoASTId);
return recorded_ast_id_;
}
void ClearRecordedAstId() { recorded_ast_id_ = kNoASTId; }
// 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.
...@@ -1244,7 +1254,7 @@ class Assembler : public AssemblerBase { ...@@ -1244,7 +1254,7 @@ class Assembler : public AssemblerBase {
// Relocation for a type-recording IC has the AST id added to it. This // 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 // member variable is a way to pass the information from the call site to
// the relocation info. // the relocation info.
unsigned ast_id_for_reloc_info_; unsigned recorded_ast_id_;
bool emit_debug_code() const { return emit_debug_code_; } bool emit_debug_code() const { return emit_debug_code_; }
......
...@@ -192,13 +192,13 @@ void MacroAssembler::Call(Handle<Code> code, ...@@ -192,13 +192,13 @@ void MacroAssembler::Call(Handle<Code> code,
bind(&start); bind(&start);
ASSERT(RelocInfo::IsCodeTarget(rmode)); ASSERT(RelocInfo::IsCodeTarget(rmode));
if (rmode == RelocInfo::CODE_TARGET && ast_id != kNoASTId) { if (rmode == RelocInfo::CODE_TARGET && ast_id != kNoASTId) {
ASSERT(ast_id_for_reloc_info_ == kNoASTId); SetRecordedAstId(ast_id);
ast_id_for_reloc_info_ = ast_id;
rmode = RelocInfo::CODE_TARGET_WITH_ID; rmode = RelocInfo::CODE_TARGET_WITH_ID;
} }
// 'code' is always generated ARM code, never THUMB code // 'code' is always generated ARM code, never THUMB code
Call(reinterpret_cast<Address>(code.location()), rmode, cond); Call(reinterpret_cast<Address>(code.location()), rmode, cond);
ASSERT_EQ(CallSize(code, rmode, cond), SizeOfCodeGeneratedSince(&start)); ASSERT_EQ(CallSize(code, rmode, ast_id, cond),
SizeOfCodeGeneratedSince(&start));
} }
...@@ -1862,7 +1862,7 @@ void MacroAssembler::TryGetFunctionPrototype(Register function, ...@@ -1862,7 +1862,7 @@ void MacroAssembler::TryGetFunctionPrototype(Register function,
void MacroAssembler::CallStub(CodeStub* stub, Condition cond) { void MacroAssembler::CallStub(CodeStub* stub, Condition cond) {
ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs. ASSERT(allow_stub_calls()); // Stub calls are not allowed in some stubs.
Call(stub->GetCode(), RelocInfo::CODE_TARGET, cond); Call(stub->GetCode(), RelocInfo::CODE_TARGET, kNoASTId, cond);
} }
...@@ -1872,7 +1872,8 @@ MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub, Condition cond) { ...@@ -1872,7 +1872,8 @@ MaybeObject* MacroAssembler::TryCallStub(CodeStub* stub, Condition cond) {
{ MaybeObject* maybe_result = stub->TryGetCode(); { MaybeObject* maybe_result = stub->TryGetCode();
if (!maybe_result->ToObject(&result)) return maybe_result; if (!maybe_result->ToObject(&result)) return maybe_result;
} }
Call(Handle<Code>(Code::cast(result)), RelocInfo::CODE_TARGET, cond); Handle<Code> code(Code::cast(result));
Call(code, RelocInfo::CODE_TARGET, kNoASTId, cond);
return result; return result;
} }
......
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