Author: [EMAIL PROTECTED]
Date: Wed Nov 26 00:03:55 2008
New Revision: 845

Modified:
    branches/bleeding_edge/src/SConscript
    branches/bleeding_edge/src/ast.h
    branches/bleeding_edge/src/jsregexp-inl.h
    branches/bleeding_edge/src/jsregexp.cc
    branches/bleeding_edge/src/jsregexp.h
    branches/bleeding_edge/src/list-inl.h
    branches/bleeding_edge/src/objects.cc
    branches/bleeding_edge/src/utils.h
    branches/bleeding_edge/test/cctest/test-regexp.cc

Log:
Merge code review fixes.


Modified: branches/bleeding_edge/src/SConscript
==============================================================================
--- branches/bleeding_edge/src/SConscript       (original)
+++ branches/bleeding_edge/src/SConscript       Wed Nov 26 00:03:55 2008
@@ -45,7 +45,7 @@
      'jsregexp.cc', 'log.cc', 'mark-compact.cc', 'messages.cc',
      'objects.cc', 'parser.cc', 'property.cc', 'regexp-macro-assembler.cc',
      'regexp-macro-assembler-irregexp.cc', 'rewriter.cc', 'runtime.cc', 
'scanner.cc',
-    'scopeinfo.cc', 'scopes.cc', 'serialize.cc', 'snapshot-common.cc',
+    'scopeinfo.cc', 'scopes.cc', 'serialize.cc', 'snapshot-common.cc',
      'spaces.cc', 'string-stream.cc', 'stub-cache.cc', 'token.cc', 'top.cc',
      'unicode.cc', 'usage-analyzer.cc', 'utils.cc', 'v8-counters.cc',
      'v8.cc', 'v8threads.cc', 'variables.cc', 'zone.cc'
@@ -55,7 +55,7 @@
        'macro-assembler-arm.cc', 'stub-cache-arm.cc'],
    'arch:ia32': ['assembler-ia32.cc', 'builtins-ia32.cc', 'codegen-ia32.cc',
        'cpu-ia32.cc', 'disasm-ia32.cc', 'frames-ia32.cc', 'ic-ia32.cc',
-      'macro-assembler-ia32.cc', 'regexp-macro-assembler-ia32.cc',
+      'macro-assembler-ia32.cc', 'regexp-macro-assembler-ia32.cc',
        'stub-cache-ia32.cc'],
    'simulator:arm': ['simulator-arm.cc'],
    'os:freebsd': ['platform-freebsd.cc'],

Modified: branches/bleeding_edge/src/ast.h
==============================================================================
--- branches/bleeding_edge/src/ast.h    (original)
+++ branches/bleeding_edge/src/ast.h    Wed Nov 26 00:03:55 2008
@@ -237,9 +237,9 @@
  class Declaration: public Node {
   public:
    Declaration(VariableProxy* proxy, Variable::Mode mode, FunctionLiteral*  
fun)
-    : proxy_(proxy),
-      mode_(mode),
-      fun_(fun) {
+      : proxy_(proxy),
+        mode_(mode),
+        fun_(fun) {
      ASSERT(mode == Variable::VAR || mode == Variable::CONST);
      // At the moment there are no "const functions"'s in JavaScript...
      ASSERT(fun == NULL || mode == Variable::VAR);
@@ -270,7 +270,7 @@

   protected:
    explicit IterationStatement(ZoneStringList* labels)
-    : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), body_(NULL) { }
+      : BreakableStatement(labels, TARGET_FOR_ANONYMOUS), body_(NULL) { }

    void Initialize(Statement* body) {
      body_ = body;
@@ -324,7 +324,7 @@
  class ForInStatement: public IterationStatement {
   public:
    explicit ForInStatement(ZoneStringList* labels)
-    : IterationStatement(labels), each_(NULL), enumerable_(NULL) { }
+      : IterationStatement(labels), each_(NULL), enumerable_(NULL) { }

    void Initialize(Expression* each, Expression* enumerable, Statement*  
body) {
      IterationStatement::Initialize(body);
@@ -812,7 +812,7 @@
    };

    Slot(Variable* var, Type type, int index)
-    : var_(var), type_(type), index_(index) {
+      : var_(var), type_(type), index_(index) {
      ASSERT(var != NULL);
    }

@@ -932,7 +932,7 @@
  class UnaryOperation: public Expression {
   public:
    UnaryOperation(Token::Value op, Expression* expression)
-    : op_(op), expression_(expression) {
+      : op_(op), expression_(expression) {
      ASSERT(Token::IsUnaryOp(op));
    }

@@ -953,7 +953,7 @@
  class BinaryOperation: public Expression {
   public:
    BinaryOperation(Token::Value op, Expression* left, Expression* right)
-    : op_(op), left_(left), right_(right) {
+      : op_(op), left_(left), right_(right) {
      ASSERT(Token::IsBinaryOp(op));
    }

@@ -1002,7 +1002,7 @@
  class CountOperation: public Expression {
   public:
    CountOperation(bool is_prefix, Token::Value op, Expression* expression)
-    : is_prefix_(is_prefix), op_(op), expression_(expression) {
+      : is_prefix_(is_prefix), op_(op), expression_(expression) {
      ASSERT(Token::IsCountOp(op));
    }

@@ -1025,7 +1025,7 @@
  class CompareOperation: public Expression {
   public:
    CompareOperation(Token::Value op, Expression* left, Expression* right)
-    : op_(op), left_(left), right_(right) {
+      : op_(op), left_(left), right_(right) {
      ASSERT(Token::IsCompareOp(op));
    }

@@ -1067,7 +1067,7 @@
  class Assignment: public Expression {
   public:
    Assignment(Token::Value op, Expression* target, Expression* value, int  
pos)
-    : op_(op), target_(target), value_(value), pos_(pos) {
+      : op_(op), target_(target), value_(value), pos_(pos) {
      ASSERT(Token::IsAssignmentOp(op));
    }

@@ -1217,7 +1217,7 @@
  class RegExpDisjunction: public RegExpTree {
   public:
    explicit RegExpDisjunction(ZoneList<RegExpTree*>* alternatives)
-    : alternatives_(alternatives) { }
+      : alternatives_(alternatives) { }
    virtual void* Accept(RegExpVisitor* visitor, void* data);
    virtual RegExpNode* ToNode(RegExpCompiler* compiler,
                               RegExpNode* on_success,
@@ -1266,8 +1266,12 @@
  class RegExpAssertion: public RegExpTree {
   public:
    enum Type {
-    START_OF_LINE, START_OF_INPUT, END_OF_LINE, END_OF_INPUT,
-    BOUNDARY, NON_BOUNDARY
+    START_OF_LINE,
+    START_OF_INPUT,
+    END_OF_LINE,
+    END_OF_INPUT,
+    BOUNDARY,
+    NON_BOUNDARY
    };
    explicit RegExpAssertion(Type type) : type_(type) { }
    virtual void* Accept(RegExpVisitor* visitor, void* data);
@@ -1285,11 +1289,11 @@
  class RegExpCharacterClass: public RegExpTree {
   public:
    RegExpCharacterClass(ZoneList<CharacterRange>* ranges, bool is_negated)
-    : ranges_(ranges),
-      is_negated_(is_negated) { }
+      : ranges_(ranges),
+        is_negated_(is_negated) { }
    explicit RegExpCharacterClass(uc16 type)
-    : ranges_(new ZoneList<CharacterRange>(2)),
-      is_negated_(false) {
+      : ranges_(new ZoneList<CharacterRange>(2)),
+        is_negated_(false) {
      CharacterRange::AddClassEscape(type, ranges_);
    }
    virtual void* Accept(RegExpVisitor* visitor, void* data);
@@ -1328,10 +1332,10 @@
  class RegExpQuantifier: public RegExpTree {
   public:
    RegExpQuantifier(int min, int max, bool is_greedy, RegExpTree* body)
-    : min_(min),
-      max_(max),
-      is_greedy_(is_greedy),
-      body_(body) { }
+      : min_(min),
+        max_(max),
+        is_greedy_(is_greedy),
+        body_(body) { }
    virtual void* Accept(RegExpVisitor* visitor, void* data);
    virtual RegExpNode* ToNode(RegExpCompiler* compiler,
                               RegExpNode* on_success,
@@ -1366,7 +1370,7 @@
  class RegExpCapture: public RegExpTree {
   public:
    explicit RegExpCapture(RegExpTree* body, int index)
-    : body_(body), index_(index), available_(CAPTURE_AVAILABLE) { }
+      : body_(body), index_(index), available_(CAPTURE_AVAILABLE) { }
    virtual void* Accept(RegExpVisitor* visitor, void* data);
    virtual RegExpNode* ToNode(RegExpCompiler* compiler,
                               RegExpNode* on_success,
@@ -1396,8 +1400,8 @@
  class RegExpLookahead: public RegExpTree {
   public:
    RegExpLookahead(RegExpTree* body, bool is_positive)
-    : body_(body),
-      is_positive_(is_positive) { }
+      : body_(body),
+        is_positive_(is_positive) { }
    virtual void* Accept(RegExpVisitor* visitor, void* data);
    virtual RegExpNode* ToNode(RegExpCompiler* compiler,
                               RegExpNode* on_success,
@@ -1415,7 +1419,7 @@
  class RegExpBackReference: public RegExpTree {
   public:
    explicit RegExpBackReference(RegExpCapture* capture)
-    : capture_(capture) { }
+      : capture_(capture) { }
    virtual void* Accept(RegExpVisitor* visitor, void* data);
    virtual RegExpNode* ToNode(RegExpCompiler* compiler,
                               RegExpNode* on_success,

Modified: branches/bleeding_edge/src/jsregexp-inl.h
==============================================================================
--- branches/bleeding_edge/src/jsregexp-inl.h   (original)
+++ branches/bleeding_edge/src/jsregexp-inl.h   Wed Nov 26 00:03:55 2008
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2008 the V8 project authors. All rights reserved.
  // Redistribution and use in source and binary forms, with or without
  // modification, are permitted provided that the following conditions are
  // met:

Modified: branches/bleeding_edge/src/jsregexp.cc
==============================================================================
--- branches/bleeding_edge/src/jsregexp.cc      (original)
+++ branches/bleeding_edge/src/jsregexp.cc      Wed Nov 26 00:03:55 2008
@@ -917,10 +917,10 @@
  // Attempts to compile the regexp using an Irregexp code generator.   
Returns
  // a fixed array or a null handle depending on whether it succeeded.
  RegExpCompiler::RegExpCompiler(int capture_count, bool ignore_case)
-  : next_register_(2 * (capture_count + 1)),
-    work_list_(NULL),
-    recursion_depth_(0),
-    is_case_independent_(ignore_case) {
+    : next_register_(2 * (capture_count + 1)),
+      work_list_(NULL),
+      recursion_depth_(0),
+      is_case_independent_(ignore_case) {
    accept_ = new EndNode(EndNode::ACCEPT);
    backtrack_ = new EndNode(EndNode::BACKTRACK);
  }
@@ -1549,7 +1549,7 @@
  class TableEntryBodyPrinter {
   public:
    TableEntryBodyPrinter(StringStream* stream, ChoiceNode* choice)
-    : stream_(stream), choice_(choice) { }
+      : stream_(stream), choice_(choice) { }
    void Call(uc16 from, DispatchTable::Entry entry) {
      OutSet* out_set = entry.out_set();
      for (unsigned i = 0; i < OutSet::kFirstLimit; i++) {
@@ -1573,7 +1573,7 @@
  class TableEntryHeaderPrinter {
   public:
    explicit TableEntryHeaderPrinter(StringStream* stream)
-    : first_(true), stream_(stream) { }
+      : first_(true), stream_(stream) { }
    void Call(uc16 from, DispatchTable::Entry entry) {
      if (first_) {
        first_ = false;
@@ -2087,8 +2087,8 @@
          ranges->Add(CharacterRange::Singleton(chars[i]));
        }
      }
-  } else if (from() <= kRangeCanonicalizeMax
-          && to() <= kRangeCanonicalizeMax) {
+  } else if (from() <= kRangeCanonicalizeMax &&
+             to() <= kRangeCanonicalizeMax) {
      // If this is a range we expand the characters block by block,
      // expanding contiguous subranges (blocks) one at a time.
      // The approach is as follows.  For a given start character we
@@ -2496,7 +2496,7 @@

  static int CompareRangeByFrom(const CharacterRange* a,
                                const CharacterRange* b) {
-  return Spaceship<uc16>(a->from(), b->from());
+  return Compare<uc16>(a->from(), b->from());
  }



Modified: branches/bleeding_edge/src/jsregexp.h
==============================================================================
--- branches/bleeding_edge/src/jsregexp.h       (original)
+++ branches/bleeding_edge/src/jsregexp.h       Wed Nov 26 00:03:55 2008
@@ -183,10 +183,7 @@
    CharacterRange() : from_(0), to_(0) { }
    // For compatibility with the CHECK_OK macro
    CharacterRange(void* null) { ASSERT_EQ(NULL, null); }  //NOLINT
-  CharacterRange(uc16 from, uc16 to)
-    : from_(from),
-      to_(to) {
-  }
+  CharacterRange(uc16 from, uc16 to) : from_(from), to_(to) { }
    static void AddClassEscape(uc16 type, ZoneList<CharacterRange>* ranges);
    static inline CharacterRange Singleton(uc16 value) {
      return CharacterRange(value, value);
@@ -276,14 +273,14 @@
    class Node : public ZoneObject {
     public:
      Node(const Key& key, const Value& value)
-      : key_(key),
-        value_(value),
-        left_(NULL),
-        right_(NULL) { }
-     Key key() { return key_; }
-     Value value() { return value_; }
-     Node* left() { return left_; }
-     Node* right() { return right_; }
+        : key_(key),
+          value_(value),
+          left_(NULL),
+          right_(NULL) { }
+    Key key() { return key_; }
+    Value value() { return value_; }
+    Node* left() { return left_; }
+    Node* right() { return right_; }
     private:
      friend class ZoneSplayTree;
      friend class Locator;
@@ -325,8 +322,8 @@
    OutSet* Extend(unsigned value);
    bool Get(unsigned value);
    static const unsigned kFirstLimit = 32;
- private:

+ private:
    // Destructively set a value in this set.  In most cases you want
    // to use Extend instead to ensure that only one instance exists
    // that contains the same values.
@@ -338,7 +335,7 @@
    ZoneList<OutSet*>* successors() { return successors_; }

    OutSet(uint32_t first, ZoneList<unsigned>* remaining)
-    : first_(first), remaining_(remaining), successors_(NULL) { }
+      : first_(first), remaining_(remaining), successors_(NULL) { }
    uint32_t first_;
    ZoneList<unsigned>* remaining_;
    ZoneList<OutSet*>* successors_;
@@ -351,10 +348,9 @@
   public:
    class Entry {
     public:
-    Entry()
-      : from_(0), to_(0), out_set_(NULL) { }
+    Entry() : from_(0), to_(0), out_set_(NULL) { }
      Entry(uc16 from, uc16 to, OutSet* out_set)
-      : from_(from), to_(to), out_set_(out_set) { }
+        : from_(from), to_(to), out_set_(out_set) { }
      uc16 from() { return from_; }
      uc16 to() { return to_; }
      void set_to(uc16 value) { to_ = value; }
@@ -442,14 +438,14 @@

  struct NodeInfo {
    NodeInfo()
-    : being_analyzed(false),
-      been_analyzed(false),
-      determine_word(false),
-      determine_newline(false),
-      determine_start(false),
-      follows_word_interest(false),
-      follows_newline_interest(false),
-      follows_start_interest(false) { }
+      : being_analyzed(false),
+        been_analyzed(false),
+        determine_word(false),
+        determine_newline(false),
+        determine_start(false),
+        follows_word_interest(false),
+        follows_newline_interest(false),
+        follows_start_interest(false) { }
    bool SameInterests(NodeInfo* that) {
      return (follows_word_interest == that->follows_word_interest)
          && (follows_newline_interest == that->follows_newline_interest)
@@ -533,7 +529,7 @@
  class SeqRegExpNode: public RegExpNode {
   public:
    explicit SeqRegExpNode(RegExpNode* on_success)
-    : on_success_(on_success) { }
+      : on_success_(on_success) { }
    RegExpNode* on_success() { return on_success_; }
    void set_on_success(RegExpNode* node) { on_success_ = node; }
    virtual bool Emit(RegExpCompiler* compiler) { return false; }
@@ -580,8 +576,8 @@
      } u_submatch_stack_pointer_register;
    } data_;
    ActionNode(Type type, RegExpNode* on_success)
-    : SeqRegExpNode(on_success),
-      type_(type) { }
+      : SeqRegExpNode(on_success),
+        type_(type) { }
    Type type_;
    friend class DotPrinter;
  };
@@ -592,9 +588,9 @@
    TextNode(ZoneList<TextElement>* elms,
             RegExpNode* on_success,
             RegExpNode* on_failure)
-    : SeqRegExpNode(on_success),
-      on_failure_(on_failure),
-      elms_(elms) { }
+      : SeqRegExpNode(on_success),
+        on_failure_(on_failure),
+        elms_(elms) { }
    virtual void Accept(NodeVisitor* visitor);
    virtual RegExpNode* PropagateInterest(NodeInfo* info);
    RegExpNode* on_failure() { return on_failure_; }
@@ -612,10 +608,10 @@
                      int end_reg,
                      RegExpNode* on_success,
                      RegExpNode* on_failure)
-    : SeqRegExpNode(on_success),
-      on_failure_(on_failure),
-      start_reg_(start_reg),
-      end_reg_(end_reg) { }
+      : SeqRegExpNode(on_success),
+        on_failure_(on_failure),
+        start_reg_(start_reg),
+        end_reg_(end_reg) { }
    virtual void Accept(NodeVisitor* visitor);
    RegExpNode* on_failure() { return on_failure_; }
    int start_register() { return start_reg_; }
@@ -647,9 +643,9 @@
   public:
    enum Relation { LT, GEQ };
    Guard(int reg, Relation op, int value)
-    : reg_(reg),
-      op_(op),
-      value_(value) { }
+      : reg_(reg),
+        op_(op),
+        value_(value) { }
    int reg() { return reg_; }
    Relation op() { return op_; }
    int value() { return value_; }
@@ -676,10 +672,10 @@
  class ChoiceNode: public RegExpNode {
   public:
    explicit ChoiceNode(int expected_size, RegExpNode* on_failure)
-    : on_failure_(on_failure),
-      alternatives_(new ZoneList<GuardedAlternative>(expected_size)),
-      table_calculated_(false),
-      being_calculated_(false) { }
+      : on_failure_(on_failure),
+        alternatives_(new ZoneList<GuardedAlternative>(expected_size)),
+        table_calculated_(false),
+        being_calculated_(false) { }
    virtual void Accept(NodeVisitor* visitor);
    void AddAlternative(GuardedAlternative node) {  
alternatives()->Add(node); }
    ZoneList<GuardedAlternative>* alternatives() { return alternatives_; }
@@ -718,8 +714,8 @@
  class DispatchTableConstructor: public NodeVisitor {
   public:
    explicit DispatchTableConstructor(DispatchTable* table)
-    : table_(table),
-      choice_index_(-1) { }
+      : table_(table),
+        choice_index_(-1) { }

    void BuildTable(ChoiceNode* node);


Modified: branches/bleeding_edge/src/list-inl.h
==============================================================================
--- branches/bleeding_edge/src/list-inl.h       (original)
+++ branches/bleeding_edge/src/list-inl.h       Wed Nov 26 00:03:55 2008
@@ -111,7 +111,7 @@

  template<typename T, class P>
  void List<T, P>::Sort() {
-  Sort(PointerSpaceship<T>);
+  Sort(PointerValueCompare<T>);
  }



Modified: branches/bleeding_edge/src/objects.cc
==============================================================================
--- branches/bleeding_edge/src/objects.cc       (original)
+++ branches/bleeding_edge/src/objects.cc       Wed Nov 26 00:03:55 2008
@@ -3505,20 +3505,20 @@


  FlatStringReader::FlatStringReader(Handle<String> str)
-  : str_(str.location()),
-    length_(str->length()),
-    prev_(top_) {
+    : str_(str.location()),
+      length_(str->length()),
+      prev_(top_) {
    top_ = this;
    RefreshState();
  }


  FlatStringReader::FlatStringReader(Vector<const char> input)
-  : str_(NULL),
-    is_ascii_(true),
-    length_(input.length()),
-    start_(input.start()),
-    prev_(top_) {
+    : str_(NULL),
+      is_ascii_(true),
+      length_(input.length()),
+      start_(input.start()),
+      prev_(top_) {
    top_ = this;
  }

@@ -5796,8 +5796,8 @@
  class RegExpKey : public HashTableKey {
   public:
    RegExpKey(String* string, JSRegExp::Flags flags)
-    : string_(string),
-      flags_(Smi::FromInt(flags.value())) { }
+      : string_(string),
+        flags_(Smi::FromInt(flags.value())) { }

    bool IsMatch(Object* obj) {
      FixedArray* val = FixedArray::cast(obj);
@@ -6188,7 +6188,7 @@
  class MapNameKey : public HashTableKey {
   public:
    MapNameKey(Map* map, String* name)
-    : map_(map), name_(name) { }
+      : map_(map), name_(name) { }

    bool IsMatch(Object* other) {
      if (!other->IsFixedArray()) return false;

Modified: branches/bleeding_edge/src/utils.h
==============================================================================
--- branches/bleeding_edge/src/utils.h  (original)
+++ branches/bleeding_edge/src/utils.h  Wed Nov 26 00:03:55 2008
@@ -84,7 +84,7 @@


  template <typename T>
-static int Spaceship(const T& a, const T& b) {
+static int Compare(const T& a, const T& b) {
    if (a == b)
      return 0;
    else if (a < b)
@@ -95,8 +95,8 @@


  template <typename T>
-static int PointerSpaceship(const T* a, const T* b) {
-  return Spaceship<T>(*a, *b);
+static int PointerValueCompare(const T* a, const T* b) {
+  return Compare<T>(*a, *b);
  }


@@ -344,7 +344,7 @@
    }

    void Sort() {
-    Sort(PointerSpaceship<T>);
+    Sort(PointerValueCompare<T>);
    }

    // Releases the array underlying this vector. Once disposed the

Modified: branches/bleeding_edge/test/cctest/test-regexp.cc
==============================================================================
--- branches/bleeding_edge/test/cctest/test-regexp.cc   (original)
+++ branches/bleeding_edge/test/cctest/test-regexp.cc   Wed Nov 26 00:03:55  
2008
@@ -1,4 +1,4 @@
-// Copyright 2006-2008 the V8 project authors. All rights reserved.
+// Copyright 2008 the V8 project authors. All rights reserved.
  // Redistribution and use in source and binary forms, with or without
  // modification, are permitted provided that the following conditions are
  // met:

--~--~---------~--~----~------------~-------~--~----~
v8-dev mailing list
v8-dev@googlegroups.com
http://groups.google.com/group/v8-dev
-~----------~----~----~----~------~----~------~--~---

Reply via email to