Commit dbc6dd66 authored by erik.corry@gmail.com's avatar erik.corry@gmail.com

Fix some style issues.

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@563 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 631519c3
......@@ -1243,8 +1243,12 @@ int CodeGenerator::FastCaseSwitchMinCaseCount() {
void CodeGenerator::GenerateFastCaseSwitchJumpTable(
SwitchStatement* node, int min_index, int range, Label *fail_label,
SmartPointer<Label*> &case_targets, SmartPointer<Label> &case_labels) {
SwitchStatement* node,
int min_index,
int range,
Label* fail_label,
Vector<Label*> case_targets,
Vector<Label> case_labels) {
ASSERT(kSmiTag == 0 && kSmiTagSize <= 2);
......
......@@ -312,24 +312,28 @@ class CodeGenerator: public Visitor {
// Allocate a jump table and create code to jump through it.
// Should call GenerateFastCaseSwitchCases to generate the code for
// all the cases at the appropriate point.
void GenerateFastCaseSwitchJumpTable(SwitchStatement* node, int min_index,
int range, Label *fail_label,
SmartPointer<Label*> &case_targets,
SmartPointer<Label>& case_labels);
void GenerateFastCaseSwitchJumpTable(SwitchStatement* node,
int min_index,
int range,
Label* fail_label,
Vector<Label*> case_targets,
Vector<Label> case_labels);
// Generate the code for cases for the fast case switch.
// Called by GenerateFastCaseSwitchJumpTable.
void GenerateFastCaseSwitchCases(SwitchStatement* node,
SmartPointer<Label> &case_labels);
Vector<Label> case_labels);
// Fast support for constant-Smi switches.
void GenerateFastCaseSwitchStatement(SwitchStatement *node, int min_index,
int range, int default_index);
void GenerateFastCaseSwitchStatement(SwitchStatement* node,
int min_index,
int range,
int default_index);
// Fast support for constant-Smi switches. Tests whether switch statement
// permits optimization and calls GenerateFastCaseSwitch if it does.
// Returns true if the fast-case switch was generated, and false if not.
bool TryGenerateFastCaseSwitchStatement(SwitchStatement *node);
bool TryGenerateFastCaseSwitchStatement(SwitchStatement* node);
// Bottle-neck interface to call the Assembler to generate the statement
......
......@@ -1599,8 +1599,12 @@ int CodeGenerator::FastCaseSwitchMinCaseCount() {
// Generate a computed jump to a switch case.
void CodeGenerator::GenerateFastCaseSwitchJumpTable(
SwitchStatement* node, int min_index, int range, Label *fail_label,
SmartPointer<Label*> &case_targets, SmartPointer<Label> &case_labels) {
SwitchStatement* node,
int min_index,
int range,
Label* fail_label,
Vector<Label*> case_targets,
Vector<Label> case_labels) {
// 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
......
......@@ -369,24 +369,28 @@ class CodeGenerator: public Visitor {
// Allocate a jump table and create code to jump through it.
// Should call GenerateFastCaseSwitchCases to generate the code for
// all the cases at the appropriate point.
void GenerateFastCaseSwitchJumpTable(SwitchStatement* node, int min_index,
int range, Label *fail_label,
SmartPointer<Label*> &case_targets,
SmartPointer<Label>& case_labels);
void GenerateFastCaseSwitchJumpTable(SwitchStatement* node,
int min_index,
int range,
Label* fail_label,
Vector<Label*> case_targets,
Vector<Label> case_labels);
// Generate the code for cases for the fast case switch.
// Called by GenerateFastCaseSwitchJumpTable.
void GenerateFastCaseSwitchCases(SwitchStatement* node,
SmartPointer<Label> &case_labels);
Vector<Label> case_labels);
// Fast support for constant-Smi switches.
void GenerateFastCaseSwitchStatement(SwitchStatement *node, int min_index,
int range, int default_index);
void GenerateFastCaseSwitchStatement(SwitchStatement* node,
int min_index,
int range,
int default_index);
// Fast support for constant-Smi switches. Tests whether switch statement
// permits optimization and calls GenerateFastCaseSwitch if it does.
// Returns true if the fast-case switch was generated, and false if not.
bool TryGenerateFastCaseSwitchStatement(SwitchStatement *node);
bool TryGenerateFastCaseSwitchStatement(SwitchStatement* node);
// Bottle-neck interface to call the Assembler to generate the statement
......
......@@ -379,14 +379,18 @@ void CodeGenerator::GenerateFastCaseSwitchStatement(SwitchStatement* node,
}
}
GenerateFastCaseSwitchJumpTable(node, min_index, range, fail_label,
case_targets, case_labels);
GenerateFastCaseSwitchJumpTable(node,
min_index,
range,
fail_label,
Vector<Label*>(*case_targets, range),
Vector<Label>(*case_labels, length));
}
void CodeGenerator::GenerateFastCaseSwitchCases(
SwitchStatement* node,
SmartPointer<Label>& case_labels) {
Vector<Label> case_labels) {
ZoneList<CaseClause*>* cases = node->cases();
int length = cases->length();
......
......@@ -2417,7 +2417,7 @@ Object* Map::Copy() {
Object* Map::CopyDropTransitions() {
Object *new_map = Copy();
Object* new_map = Copy();
if (new_map->IsFailure()) return new_map;
Object* descriptors = instance_descriptors()->RemoveTransitions();
if (descriptors->IsFailure()) return descriptors;
......
......@@ -2921,7 +2921,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(Handle<String> var_name,
entry.set_contains_array_literal(contains_array_literal);
}
FunctionLiteral *function_literal =
FunctionLiteral* function_literal =
NEW(FunctionLiteral(name, top_scope_,
body.elements(), materialized_literal_count,
contains_array_literal, expected_property_count,
......
......@@ -101,7 +101,7 @@ static Object* Runtime_CloneObjectLiteralBoilerplate(Arguments args) {
static Handle<Map> ComputeObjectLiteralMap(
Handle<Context> context,
Handle<FixedArray> constant_properties,
bool &is_result_from_cache) {
bool* is_result_from_cache) {
if (FLAG_canonicalize_object_literal_maps) {
// First find prefix of consecutive symbol keys.
int number_of_properties = constant_properties->length()/2;
......@@ -120,11 +120,11 @@ static Handle<Map> ComputeObjectLiteralMap(
for (int i = 0; i < number_of_symbol_keys; i++) {
keys->set(i, constant_properties->get(i*2));
}
is_result_from_cache = true;
*is_result_from_cache = true;
return Factory::ObjectLiteralMapFromCache(context, keys);
}
}
is_result_from_cache = false;
*is_result_from_cache = false;
return Handle<Map>(context->object_function()->initial_map());
}
......@@ -149,7 +149,7 @@ static Object* Runtime_CreateObjectLiteralBoilerplate(Arguments args) {
bool is_result_from_cache;
Handle<Map> map = ComputeObjectLiteralMap(context,
constant_properties,
is_result_from_cache);
&is_result_from_cache);
Handle<JSObject> boilerplate = Factory::NewJSObjectFromMap(map);
{ // Add the constant propeties to the boilerplate.
......@@ -1014,8 +1014,8 @@ class BMGoodSuffixBuffers {
private:
int suffixes_[kBMMaxShift + 1];
int good_suffix_shift_[kBMMaxShift + 1];
int *biased_suffixes_;
int *biased_good_suffix_shift_;
int* biased_suffixes_;
int* biased_good_suffix_shift_;
DISALLOW_COPY_AND_ASSIGN(BMGoodSuffixBuffers);
};
......@@ -1118,7 +1118,7 @@ template <typename schar, typename pchar>
static int BoyerMooreSimplified(Vector<const schar> subject,
Vector<const pchar> pattern,
int start_index,
bool& complete) {
bool* complete) {
int n = subject.length();
int m = pattern.length();
// Only preprocess at most kBMMaxShift last characters of pattern.
......@@ -1139,14 +1139,14 @@ static int BoyerMooreSimplified(Vector<const schar> subject,
idx += shift;
badness += 1 - shift; // at most zero, so badness cannot increase.
if (idx > n - m) {
complete = true;
*complete = true;
return -1;
}
}
j--;
while (j >= 0 && pattern[j] == (c = subject[idx + j])) j--;
if (j < 0) {
complete = true;
*complete = true;
return idx;
} else {
int bc_occ = CharOccurence<schar, pchar>(c);
......@@ -1158,12 +1158,12 @@ static int BoyerMooreSimplified(Vector<const schar> subject,
// compared to reading each character exactly once.
badness += (m - j) - shift;
if (badness > 0) {
complete = false;
*complete = false;
return idx;
}
}
}
complete = true;
*complete = true;
return -1;
}
......@@ -1235,7 +1235,7 @@ template <typename pchar, typename schar>
static int SimpleIndexOf(Vector<const schar> subject,
Vector<const pchar> pattern,
int idx,
bool &complete) {
bool* complete) {
// Badness is a count of how much work we have done. When we have
// done enough work we decide it's probably worth switching to a better
// algorithm.
......@@ -1247,7 +1247,7 @@ static int SimpleIndexOf(Vector<const schar> subject,
for (int i = idx, n = subject.length() - pattern.length(); i <= n; i++) {
badness++;
if (badness > 0) {
complete = false;
*complete = false;
return (i);
}
if (subject[i] != pattern_first_char) continue;
......@@ -1259,12 +1259,12 @@ static int SimpleIndexOf(Vector<const schar> subject,
j++;
} while (j < pattern.length());
if (j == pattern.length()) {
complete = true;
*complete = true;
return i;
}
badness += j;
}
complete = true;
*complete = true;
return -1;
}
......@@ -1317,9 +1317,9 @@ static int StringMatchStrategy(Vector<const schar> sub,
}
// Try algorithms in order of increasing setup cost and expected performance.
bool complete;
int idx = SimpleIndexOf(sub, pat, start_index, complete);
int idx = SimpleIndexOf(sub, pat, start_index, &complete);
if (complete) return idx;
idx = BoyerMooreSimplified(sub, pat, idx, complete);
idx = BoyerMooreSimplified(sub, pat, idx, &complete);
if (complete) return idx;
return BoyerMooreIndexOf(sub, pat, idx);
}
......
......@@ -878,14 +878,14 @@ void Serializer::InitializeAllocators() {
}
bool Serializer::IsVisited(HeapObject *obj) {
bool Serializer::IsVisited(HeapObject* obj) {
HashMap::Entry* entry =
saved_addresses_.Lookup(obj, HeapObjectHash(obj), false);
return entry != NULL;
}
Address Serializer::GetSavedAddress(HeapObject *obj) {
Address Serializer::GetSavedAddress(HeapObject* obj) {
HashMap::Entry* entry
= saved_addresses_.Lookup(obj, HeapObjectHash(obj), false);
ASSERT(entry != NULL);
......@@ -1395,7 +1395,7 @@ Object* Deserializer::GetObject() {
// Get a raw object of the right size in the right space.
AllocationSpace space = GetSpace(a);
Object *o;
Object* o;
if (IsLargeExecutableObject(a)) {
o = Heap::lo_space()->AllocateRawCode(size);
} else if (IsLargeFixedArray(a)) {
......@@ -1453,7 +1453,7 @@ static inline Object* ResolvePaged(int page_index,
template<typename T>
void ConcatReversed(List<T> * target, const List<T> & source) {
void ConcatReversed(List<T>* target, const List<T>& source) {
for (int i = source.length() - 1; i >= 0; i--) {
target->Add(source[i]);
}
......
......@@ -154,9 +154,9 @@ class Serializer: public ObjectVisitor {
virtual void VisitPointers(Object** start, Object** end);
bool IsVisited(HeapObject *obj);
bool IsVisited(HeapObject* obj);
Address GetSavedAddress(HeapObject *obj);
Address GetSavedAddress(HeapObject* obj);
void SaveAddress(HeapObject* obj, Address addr);
......
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