Author: [EMAIL PROTECTED]
Date: Thu Sep 18 06:42:39 2008
New Revision: 344
Modified:
branches/bleeding_edge/src/assembler-ia32.cc
branches/bleeding_edge/src/assembler-ia32.h
branches/bleeding_edge/src/assembler.h
branches/bleeding_edge/src/codegen-ia32.cc
Log:
Fix lint issues.
Review URL: http://codereview.chromium.org/3144
Modified: branches/bleeding_edge/src/assembler-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/assembler-ia32.cc (original)
+++ branches/bleeding_edge/src/assembler-ia32.cc Thu Sep 18 06:42:39 2008
@@ -2018,6 +2018,7 @@
EMIT(b2 + i);
}
+
void Assembler::dd(uint32_t data, RelocMode reloc_info) {
EnsureSpace ensure_space(this);
emit(data, reloc_info);
@@ -2036,9 +2037,10 @@
reloc_info_writer.Write(&rinfo);
}
-void Assembler::WriteInternalReference(int position, Label &bound_label) {
+void Assembler::WriteInternalReference(int position, const Label&
bound_label) {
ASSERT(bound_label.is_bound());
- ASSERT(0 <= position && position + (int)sizeof(uint32_t) <= pc_offset());
+ ASSERT(0 <= position);
+ ASSERT(position + static_cast<int>(sizeof(uint32_t)) <= pc_offset());
ASSERT(long_at(position) == 0); // only initialize once!
uint32_t label_loc =
reinterpret_cast<uint32_t>(addr_at(bound_label.pos()));
Modified: branches/bleeding_edge/src/assembler-ia32.h
==============================================================================
--- branches/bleeding_edge/src/assembler-ia32.h (original)
+++ branches/bleeding_edge/src/assembler-ia32.h Thu Sep 18 06:42:39 2008
@@ -683,7 +683,7 @@
// Writes the absolute address of a bound label at the given position in
// the generated code. That positions should have the relocation mode
// internal_reference!
- void WriteInternalReference(int position, Label &bound_label);
+ void WriteInternalReference(int position, const Label& bound_label);
int pc_offset() const { return pc_ - buffer_; }
int last_statement_position() const { return last_statement_position_; }
Modified: branches/bleeding_edge/src/assembler.h
==============================================================================
--- branches/bleeding_edge/src/assembler.h (original)
+++ branches/bleeding_edge/src/assembler.h Thu Sep 18 06:42:39 2008
@@ -162,7 +162,7 @@
// add more as needed
// Pseudo-types
- reloc_mode_count, // Must be no greater than 14. See RelocInfoWriter.
+ reloc_mode_count, // must be no greater than 14 - see RelocInfoWriter
no_reloc, // never recorded
last_code_enum = code_target,
last_gced_enum = embedded_string
@@ -214,13 +214,16 @@
return mode == statement_position;
}
+
inline bool is_external_reference(RelocMode mode) {
return mode == external_reference;
}
-inline bool is_internal_reference(RelocMode mode) {
+
+inline bool is_internal_reference(RelocMode mode) {
return mode == internal_reference;
}
+
// Relocation information consists of the address (pc) of the datum
// to which the relocation information applies, the relocation mode
Modified: branches/bleeding_edge/src/codegen-ia32.cc
==============================================================================
--- branches/bleeding_edge/src/codegen-ia32.cc (original)
+++ branches/bleeding_edge/src/codegen-ia32.cc Thu Sep 18 06:42:39 2008
@@ -322,7 +322,7 @@
static const int kFastSwitchMaxOverheadFactor = 5;
// Minimal number of switch cases required before we allow jump-table
- // optimization.
+ // optimization.
static const int kFastSwitchMinCaseCount = 5;
// Create fast switch implementation if all labels are small integers
@@ -2939,34 +2939,35 @@
// be populated later when the adresses of the targets are known
void Ia32CodeGenerator::GenerateFastCaseSwitchJumpTable(
int min_index, int range, Label *fail_label, Label &table_start) {
- // Notice: Internal references, used by both the jmp instruction and the
- // table entries, need to be relocated if the buffer grows. This prevents
- // the forward use of Labels, since a displacement cannot survive
relocation,
- // and it also cannot safely be distinguished from a real address.
- // Instead we put in zero-values as placeholders, and fill in the
adresses after
- // the labels have been bound.
+ // Notice: Internal references, used by both the jmp instruction and
+ // the table entries, need to be relocated if the buffer grows. This
+ // prevents the forward use of Labels, since a displacement cannot
+ // survive relocation, and it also cannot safely be distinguished
+ // from a real address. Instead we put in zero-values as
+ // placeholders, and fill in the adresses after the labels have been
+ // bound.
- __ pop(eax); // supposed Smi
+ __ pop(eax); // supposed smi
// check range of value, if outside [0..length-1] jump to default/end
label.
ASSERT(kSmiTagSize == 1 && kSmiTag == 0);
if (min_index != 0) {
- __ sub(Operand(eax), Immediate(min_index * 2)); // Smi subtraction
+ __ sub(Operand(eax), Immediate(min_index * 2)); // smi subtraction
}
- __ test(eax, Immediate(0x80000000 | kSmiTagMask)); // negative or not
Smi
+ __ test(eax, Immediate(0x80000000 | kSmiTagMask)); // negative or not
smi
__ j(not_equal, fail_label, not_taken);
__ cmp(eax, range * 2);
__ j(greater_equal, fail_label, not_taken);
__ jmp(Operand(eax, times_2, 0x0, internal_reference)); // 0 is
placeholder
// calculate address to overwrite later with actual address of table.
- int32_t jump_table_ref = __ pc_offset() - sizeof(int32_t);
-
+ int32_t jump_table_ref = __ pc_offset() - sizeof(int32_t);
+
__ Align(4);
__ bind(&table_start);
__ WriteInternalReference(jump_table_ref, table_start);
-
+
for (int i = 0; i < range; i++) {
- __ dd(0x0, internal_reference); // table entry, 0 is placeholder
+ __ dd(0x0, internal_reference); // table entry, 0 is placeholder
}
}
@@ -2994,14 +2995,15 @@
Label* fail_label = (default_index >= 0 ? &(case_labels[default_index])
: node->break_target());
- // create array of labels to jump to by index.
- // set default jump targets everywhere
+ // Create array of labels to jump to by index and set default jump
+ // targets everywhere.
for (int i = 0; i < range; i++) {
// length => end label
case_targets[i] = fail_label;
}
- // overwrite for values of cases:
- // (reverse order, so that if same label twice, the first one wins)
+
+ // Overwrite for values of cases:
+ // (reverse order, so that if same label twice, the first one wins).
for (int i = length-1; i >= 0 ; i--) {
CaseClause* clause = cases->at(i);
if (!clause->is_default()) {
@@ -3024,7 +3026,7 @@
__ bind(node->break_target());
- // all labels bound now, so we can populate the table with the
+ // All labels bound now, so we can populate the table with the
// correct addresses.
PopulateFastCaseSwitchJumpTable(table_start, case_targets, range);
}
@@ -3034,10 +3036,10 @@
ZoneList<CaseClause*>* cases = node->cases();
int length = cases->length();
- if (length < kFastSwitchMinCaseCount) {
+ if (length < kFastSwitchMinCaseCount) {
return false;
}
-
+
// Test whether fast-case should be used.
int default_index = -1;
int min_index = Smi::kMaxValue;
@@ -3065,7 +3067,8 @@
if (smi > max_index) { max_index = smi; }
}
}
- // all labels are Smi.
+
+ // After this all labels are smis.
int range = max_index - min_index + 1; // |min..max| inclusive
if (range / kFastSwitchMaxOverheadFactor > length) {
return false; // range of labels is too sparse
--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---