v8  3.11.10(node0.8.26)
V8 is Google's open source JavaScript engine
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
assembler.h
Go to the documentation of this file.
1 // Copyright (c) 1994-2006 Sun Microsystems Inc.
2 // All Rights Reserved.
3 //
4 // Redistribution and use in source and binary forms, with or without
5 // modification, are permitted provided that the following conditions are
6 // met:
7 //
8 // - Redistributions of source code must retain the above copyright notice,
9 // this list of conditions and the following disclaimer.
10 //
11 // - Redistribution in binary form must reproduce the above copyright
12 // notice, this list of conditions and the following disclaimer in the
13 // documentation and/or other materials provided with the distribution.
14 //
15 // - Neither the name of Sun Microsystems or the names of contributors may
16 // be used to endorse or promote products derived from this software without
17 // specific prior written permission.
18 //
19 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
20 // IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21 // THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 // PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
23 // CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 // EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 // PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 // LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 // NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 // SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 // The original source code covered by the above license above has been
32 // modified significantly by Google Inc.
33 // Copyright 2012 the V8 project authors. All rights reserved.
34 
35 #ifndef V8_ASSEMBLER_H_
36 #define V8_ASSEMBLER_H_
37 
38 #include "v8.h"
39 
40 #include "allocation.h"
41 #include "builtins.h"
42 #include "gdb-jit.h"
43 #include "isolate.h"
44 #include "runtime.h"
45 #include "token.h"
46 
47 namespace v8 {
48 
49 class ApiFunction;
50 
51 namespace internal {
52 
53 struct StatsCounter;
54 const unsigned kNoASTId = -1;
55 // -----------------------------------------------------------------------------
56 // Platform independent assembler base class.
57 
58 class AssemblerBase: public Malloced {
59  public:
60  explicit AssemblerBase(Isolate* isolate);
61 
62  Isolate* isolate() const { return isolate_; }
63  int jit_cookie() { return jit_cookie_; }
64 
65  // Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for
66  // cross-snapshotting.
67  static void QuietNaN(HeapObject* nan) { }
68 
69  private:
70  Isolate* isolate_;
71  int jit_cookie_;
72 };
73 
74 
75 // -----------------------------------------------------------------------------
76 // Labels represent pc locations; they are typically jump or call targets.
77 // After declaration, a label can be freely used to denote known or (yet)
78 // unknown pc location. Assembler::bind() is used to bind a label to the
79 // current pc. A label can be bound only once.
80 
81 class Label BASE_EMBEDDED {
82  public:
83  enum Distance {
84  kNear, kFar
85  };
86 
87  INLINE(Label()) {
88  Unuse();
89  UnuseNear();
90  }
91 
92  INLINE(~Label()) {
93  ASSERT(!is_linked());
94  ASSERT(!is_near_linked());
95  }
96 
97  INLINE(void Unuse()) { pos_ = 0; }
98  INLINE(void UnuseNear()) { near_link_pos_ = 0; }
99 
100  INLINE(bool is_bound() const) { return pos_ < 0; }
101  INLINE(bool is_unused() const) { return pos_ == 0 && near_link_pos_ == 0; }
102  INLINE(bool is_linked() const) { return pos_ > 0; }
103  INLINE(bool is_near_linked() const) { return near_link_pos_ > 0; }
104 
105  // Returns the position of bound or linked labels. Cannot be used
106  // for unused labels.
107  int pos() const;
108  int near_link_pos() const { return near_link_pos_ - 1; }
109 
110  private:
111  // pos_ encodes both the binding state (via its sign)
112  // and the binding position (via its value) of a label.
113  //
114  // pos_ < 0 bound label, pos() returns the jump target position
115  // pos_ == 0 unused label
116  // pos_ > 0 linked label, pos() returns the last reference position
117  int pos_;
118 
119  // Behaves like |pos_| in the "> 0" case, but for near jumps to this label.
120  int near_link_pos_;
121 
122  void bind_to(int pos) {
123  pos_ = -pos - 1;
124  ASSERT(is_bound());
125  }
126  void link_to(int pos, Distance distance = kFar) {
127  if (distance == kNear) {
128  near_link_pos_ = pos + 1;
129  ASSERT(is_near_linked());
130  } else {
131  pos_ = pos + 1;
132  ASSERT(is_linked());
133  }
134  }
135 
136  friend class Assembler;
137  friend class RegexpAssembler;
138  friend class Displacement;
139  friend class RegExpMacroAssemblerIrregexp;
140 };
141 
142 
144 
145 
146 // -----------------------------------------------------------------------------
147 // Relocation information
148 
149 
150 // Relocation information consists of the address (pc) of the datum
151 // to which the relocation information applies, the relocation mode
152 // (rmode), and an optional data field. The relocation mode may be
153 // "descriptive" and not indicate a need for relocation, but simply
154 // describe a property of the datum. Such rmodes are useful for GC
155 // and nice disassembly output.
156 
157 class RelocInfo BASE_EMBEDDED {
158  public:
159  // The constant kNoPosition is used with the collecting of source positions
160  // in the relocation information. Two types of source positions are collected
161  // "position" (RelocMode position) and "statement position" (RelocMode
162  // statement_position). The "position" is collected at places in the source
163  // code which are of interest when making stack traces to pin-point the source
164  // location of a stack frame as close as possible. The "statement position" is
165  // collected at the beginning at each statement, and is used to indicate
166  // possible break locations. kNoPosition is used to indicate an
167  // invalid/uninitialized position value.
168  static const int kNoPosition = -1;
169 
170  // This string is used to add padding comments to the reloc info in cases
171  // where we are not sure to have enough space for patching in during
172  // lazy deoptimization. This is the case if we have indirect calls for which
173  // we do not normally record relocation info.
174  static const char* const kFillerCommentString;
175 
176  // The minimum size of a comment is equal to three bytes for the extra tagged
177  // pc + the tag for the data, and kPointerSize for the actual pointer to the
178  // comment.
179  static const int kMinRelocCommentSize = 3 + kPointerSize;
180 
181  // The maximum size for a call instruction including pc-jump.
182  static const int kMaxCallSize = 6;
183 
184  // The maximum pc delta that will use the short encoding.
185  static const int kMaxSmallPCDelta;
186 
187  enum Mode {
188  // Please note the order is important (see IsCodeTarget, IsGCRelocMode).
189  CODE_TARGET, // Code target which is not any of the above.
191  CONSTRUCT_CALL, // code target that is a call to a JavaScript constructor.
192  CODE_TARGET_CONTEXT, // Code target used for contextual loads and stores.
193  DEBUG_BREAK, // Code target for the debugger statement.
196 
197  // Everything after runtime_entry (inclusive) is not GC'ed.
199  JS_RETURN, // Marks start of the ExitJSFrame code.
201  POSITION, // See comment for kNoPosition above.
202  STATEMENT_POSITION, // See comment for kNoPosition above.
203  DEBUG_BREAK_SLOT, // Additional code inserted for debug break slot.
204  EXTERNAL_REFERENCE, // The address of an external C++ function.
205  INTERNAL_REFERENCE, // An address inside the same function.
206 
207  // add more as needed
208  // Pseudo-types
209  NUMBER_OF_MODES, // There are at most 14 modes with noncompact encoding.
210  NONE, // never recorded
211  LAST_CODE_ENUM = DEBUG_BREAK,
212  LAST_GCED_ENUM = GLOBAL_PROPERTY_CELL,
213  // Modes <= LAST_COMPACT_ENUM are guaranteed to have compact encoding.
214  LAST_COMPACT_ENUM = CODE_TARGET_WITH_ID
215  };
216 
217 
219 
220  RelocInfo(byte* pc, Mode rmode, intptr_t data, Code* host)
221  : pc_(pc), rmode_(rmode), data_(data), host_(host) {
222  }
223 
224  static inline bool IsConstructCall(Mode mode) {
225  return mode == CONSTRUCT_CALL;
226  }
227  static inline bool IsCodeTarget(Mode mode) {
228  return mode <= LAST_CODE_ENUM;
229  }
230  static inline bool IsEmbeddedObject(Mode mode) {
231  return mode == EMBEDDED_OBJECT;
232  }
233  // Is the relocation mode affected by GC?
234  static inline bool IsGCRelocMode(Mode mode) {
235  return mode <= LAST_GCED_ENUM;
236  }
237  static inline bool IsJSReturn(Mode mode) {
238  return mode == JS_RETURN;
239  }
240  static inline bool IsComment(Mode mode) {
241  return mode == COMMENT;
242  }
243  static inline bool IsPosition(Mode mode) {
244  return mode == POSITION || mode == STATEMENT_POSITION;
245  }
246  static inline bool IsStatementPosition(Mode mode) {
247  return mode == STATEMENT_POSITION;
248  }
249  static inline bool IsExternalReference(Mode mode) {
250  return mode == EXTERNAL_REFERENCE;
251  }
252  static inline bool IsInternalReference(Mode mode) {
253  return mode == INTERNAL_REFERENCE;
254  }
255  static inline bool IsDebugBreakSlot(Mode mode) {
256  return mode == DEBUG_BREAK_SLOT;
257  }
258  static inline int ModeMask(Mode mode) { return 1 << mode; }
259 
260  // Accessors
261  byte* pc() const { return pc_; }
262  void set_pc(byte* pc) { pc_ = pc; }
263  Mode rmode() const { return rmode_; }
264  intptr_t data() const { return data_; }
265  Code* host() const { return host_; }
266 
267  // Apply a relocation by delta bytes
268  INLINE(void apply(intptr_t delta));
269 
270  // Is the pointer this relocation info refers to coded like a plain pointer
271  // or is it strange in some way (e.g. relative or patched into a series of
272  // instructions).
273  bool IsCodedSpecially();
274 
275  // Read/modify the code target in the branch/call instruction
276  // this relocation applies to;
277  // can only be called if IsCodeTarget(rmode_) || rmode_ == RUNTIME_ENTRY
278  INLINE(Address target_address());
279  INLINE(void set_target_address(Address target,
281  INLINE(Object* target_object());
282  INLINE(Handle<Object> target_object_handle(Assembler* origin));
283  INLINE(Object** target_object_address());
284  INLINE(void set_target_object(Object* target,
286  INLINE(JSGlobalPropertyCell* target_cell());
287  INLINE(Handle<JSGlobalPropertyCell> target_cell_handle());
288  INLINE(void set_target_cell(JSGlobalPropertyCell* cell,
290 
291 
292  // Read the address of the word containing the target_address in an
293  // instruction stream. What this means exactly is architecture-independent.
294  // The only architecture-independent user of this function is the serializer.
295  // The serializer uses it to find out how many raw bytes of instruction to
296  // output before the next target. Architecture-independent code shouldn't
297  // dereference the pointer it gets back from this.
298  INLINE(Address target_address_address());
299  // This indicates how much space a target takes up when deserializing a code
300  // stream. For most architectures this is just the size of a pointer. For
301  // an instruction like movw/movt where the target bits are mixed into the
302  // instruction bits the size of the target will be zero, indicating that the
303  // serializer should not step forwards in memory after a target is resolved
304  // and written. In this case the target_address_address function above
305  // should return the end of the instructions to be patched, allowing the
306  // deserializer to deserialize the instructions as raw bytes and put them in
307  // place, ready to be patched with the target.
308  INLINE(int target_address_size());
309 
310  // Read/modify the reference in the instruction this relocation
311  // applies to; can only be called if rmode_ is external_reference
312  INLINE(Address* target_reference_address());
313 
314  // Read/modify the address of a call instruction. This is used to relocate
315  // the break points where straight-line code is patched with a call
316  // instruction.
317  INLINE(Address call_address());
318  INLINE(void set_call_address(Address target));
319  INLINE(Object* call_object());
320  INLINE(void set_call_object(Object* target));
321  INLINE(Object** call_object_address());
322 
323  template<typename StaticVisitor> inline void Visit(Heap* heap);
324  inline void Visit(ObjectVisitor* v);
325 
326  // Patch the code with some other code.
327  void PatchCode(byte* instructions, int instruction_count);
328 
329  // Patch the code with a call.
330  void PatchCodeWithCall(Address target, int guard_bytes);
331 
332  // Check whether this return sequence has been patched
333  // with a call to the debugger.
334  INLINE(bool IsPatchedReturnSequence());
335 
336  // Check whether this debug break slot has been patched with a call to the
337  // debugger.
338  INLINE(bool IsPatchedDebugBreakSlotSequence());
339 
340 #ifdef ENABLE_DISASSEMBLER
341  // Printing
342  static const char* RelocModeName(Mode rmode);
343  void Print(FILE* out);
344 #endif // ENABLE_DISASSEMBLER
345 #ifdef DEBUG
346  // Debugging
347  void Verify();
348 #endif
349 
350  static const int kCodeTargetMask = (1 << (LAST_CODE_ENUM + 1)) - 1;
351  static const int kPositionMask = 1 << POSITION | 1 << STATEMENT_POSITION;
352  static const int kDataMask =
353  (1 << CODE_TARGET_WITH_ID) | kPositionMask | (1 << COMMENT);
354  static const int kApplyMask; // Modes affected by apply. Depends on arch.
355 
356  private:
357  // On ARM, note that pc_ is the address of the constant pool entry
358  // to be relocated and not the address of the instruction
359  // referencing the constant pool entry (except when rmode_ ==
360  // comment).
361  byte* pc_;
362  Mode rmode_;
363  intptr_t data_;
364  Code* host_;
365 #ifdef V8_TARGET_ARCH_MIPS
366  // Code and Embedded Object pointers in mips are stored split
367  // across two consecutive 32-bit instructions. Heap management
368  // routines expect to access these pointers indirectly. The following
369  // location provides a place for these pointers to exist natually
370  // when accessed via the Iterator.
371  Object* reconstructed_obj_ptr_;
372  // External-reference pointers are also split across instruction-pairs
373  // in mips, but are accessed via indirect pointers. This location
374  // provides a place for that pointer to exist naturally. Its address
375  // is returned by RelocInfo::target_reference_address().
376  Address reconstructed_adr_ptr_;
377 #endif // V8_TARGET_ARCH_MIPS
378  friend class RelocIterator;
379 };
380 
381 
382 // RelocInfoWriter serializes a stream of relocation info. It writes towards
383 // lower addresses.
384 class RelocInfoWriter BASE_EMBEDDED {
385  public:
387  last_pc_(NULL),
388  last_id_(0),
389  last_position_(0) {}
390  RelocInfoWriter(byte* pos, byte* pc) : pos_(pos),
391  last_pc_(pc),
392  last_id_(0),
393  last_position_(0) {}
394 
395  byte* pos() const { return pos_; }
396  byte* last_pc() const { return last_pc_; }
397 
398  void Write(const RelocInfo* rinfo);
399 
400  // Update the state of the stream after reloc info buffer
401  // and/or code is moved while the stream is active.
402  void Reposition(byte* pos, byte* pc) {
403  pos_ = pos;
404  last_pc_ = pc;
405  }
406 
407  // Max size (bytes) of a written RelocInfo. Longest encoding is
408  // ExtraTag, VariableLengthPCJump, ExtraTag, pc_delta, ExtraTag, data_delta.
409  // On ia32 and arm this is 1 + 4 + 1 + 1 + 1 + 4 = 12.
410  // On x64 this is 1 + 4 + 1 + 1 + 1 + 8 == 16;
411  // Here we use the maximum of the two.
412  static const int kMaxSize = 16;
413 
414  private:
415  inline uint32_t WriteVariableLengthPCJump(uint32_t pc_delta);
416  inline void WriteTaggedPC(uint32_t pc_delta, int tag);
417  inline void WriteExtraTaggedPC(uint32_t pc_delta, int extra_tag);
418  inline void WriteExtraTaggedIntData(int data_delta, int top_tag);
419  inline void WriteExtraTaggedData(intptr_t data_delta, int top_tag);
420  inline void WriteTaggedData(intptr_t data_delta, int tag);
421  inline void WriteExtraTag(int extra_tag, int top_tag);
422 
423  byte* pos_;
424  byte* last_pc_;
425  int last_id_;
426  int last_position_;
427  DISALLOW_COPY_AND_ASSIGN(RelocInfoWriter);
428 };
429 
430 
431 // A RelocIterator iterates over relocation information.
432 // Typical use:
433 //
434 // for (RelocIterator it(code); !it.done(); it.next()) {
435 // // do something with it.rinfo() here
436 // }
437 //
438 // A mask can be specified to skip unwanted modes.
439 class RelocIterator: public Malloced {
440  public:
441  // Create a new iterator positioned at
442  // the beginning of the reloc info.
443  // Relocation information with mode k is included in the
444  // iteration iff bit k of mode_mask is set.
445  explicit RelocIterator(Code* code, int mode_mask = -1);
446  explicit RelocIterator(const CodeDesc& desc, int mode_mask = -1);
447 
448  // Iteration
449  bool done() const { return done_; }
450  void next();
451 
452  // Return pointer valid until next next().
453  RelocInfo* rinfo() {
454  ASSERT(!done());
455  return &rinfo_;
456  }
457 
458  private:
459  // Advance* moves the position before/after reading.
460  // *Read* reads from current byte(s) into rinfo_.
461  // *Get* just reads and returns info on current byte.
462  void Advance(int bytes = 1) { pos_ -= bytes; }
463  int AdvanceGetTag();
464  int GetExtraTag();
465  int GetTopTag();
466  void ReadTaggedPC();
467  void AdvanceReadPC();
468  void AdvanceReadId();
469  void AdvanceReadPosition();
470  void AdvanceReadData();
471  void AdvanceReadVariableLengthPCJump();
472  int GetLocatableTypeTag();
473  void ReadTaggedId();
474  void ReadTaggedPosition();
475 
476  // If the given mode is wanted, set it in rinfo_ and return true.
477  // Else return false. Used for efficiently skipping unwanted modes.
478  bool SetMode(RelocInfo::Mode mode) {
479  return (mode_mask_ & (1 << mode)) ? (rinfo_.rmode_ = mode, true) : false;
480  }
481 
482  byte* pos_;
483  byte* end_;
484  RelocInfo rinfo_;
485  bool done_;
486  int mode_mask_;
487  int last_id_;
488  int last_position_;
489  DISALLOW_COPY_AND_ASSIGN(RelocIterator);
490 };
491 
492 
493 //------------------------------------------------------------------------------
494 // External function
495 
496 //----------------------------------------------------------------------------
497 class IC_Utility;
498 class SCTableReference;
499 #ifdef ENABLE_DEBUGGER_SUPPORT
500 class Debug_Address;
501 #endif
502 
503 
504 // An ExternalReference represents a C++ address used in the generated
505 // code. All references to C++ functions and variables must be encapsulated in
506 // an ExternalReference instance. This is done in order to track the origin of
507 // all external references in the code so that they can be bound to the correct
508 // addresses when deserializing a heap.
509 class ExternalReference BASE_EMBEDDED {
510  public:
511  // Used in the simulator to support different native api calls.
512  enum Type {
513  // Builtin call.
514  // MaybeObject* f(v8::internal::Arguments).
515  BUILTIN_CALL, // default
516 
517  // Builtin that takes float arguments and returns an int.
518  // int f(double, double).
520 
521  // Builtin call that returns floating point.
522  // double f(double, double).
524 
525  // Builtin call that returns floating point.
526  // double f(double).
528 
529  // Builtin call that returns floating point.
530  // double f(double, int).
532 
533  // Direct call to API function callback.
534  // Handle<Value> f(v8::Arguments&)
536 
537  // Direct call to accessor getter callback.
538  // Handle<value> f(Local<String> property, AccessorInfo& info)
539  DIRECT_GETTER_CALL
540  };
541 
542  static void SetUp();
543 
544  typedef void* ExternalReferenceRedirector(void* original, Type type);
545 
546  ExternalReference(Builtins::CFunctionId id, Isolate* isolate);
547 
548  ExternalReference(ApiFunction* ptr, Type type, Isolate* isolate);
549 
550  ExternalReference(Builtins::Name name, Isolate* isolate);
551 
552  ExternalReference(Runtime::FunctionId id, Isolate* isolate);
553 
554  ExternalReference(const Runtime::Function* f, Isolate* isolate);
555 
556  ExternalReference(const IC_Utility& ic_utility, Isolate* isolate);
557 
558 #ifdef ENABLE_DEBUGGER_SUPPORT
559  ExternalReference(const Debug_Address& debug_address, Isolate* isolate);
560 #endif
561 
562  explicit ExternalReference(StatsCounter* counter);
563 
564  ExternalReference(Isolate::AddressId id, Isolate* isolate);
565 
566  explicit ExternalReference(const SCTableReference& table_ref);
567 
568  // Isolate::Current() as an external reference.
569  static ExternalReference isolate_address();
570 
571  // One-of-a-kind references. These references are not part of a general
572  // pattern. This means that they have to be added to the
573  // ExternalReferenceTable in serialize.cc manually.
574 
575  static ExternalReference incremental_marking_record_write_function(
576  Isolate* isolate);
577  static ExternalReference incremental_evacuation_record_write_function(
578  Isolate* isolate);
579  static ExternalReference store_buffer_overflow_function(
580  Isolate* isolate);
581  static ExternalReference flush_icache_function(Isolate* isolate);
582  static ExternalReference perform_gc_function(Isolate* isolate);
583  static ExternalReference fill_heap_number_with_random_function(
584  Isolate* isolate);
585  static ExternalReference random_uint32_function(Isolate* isolate);
586  static ExternalReference transcendental_cache_array_address(Isolate* isolate);
587  static ExternalReference delete_handle_scope_extensions(Isolate* isolate);
588 
589  static ExternalReference get_date_field_function(Isolate* isolate);
590  static ExternalReference date_cache_stamp(Isolate* isolate);
591 
592  // Deoptimization support.
593  static ExternalReference new_deoptimizer_function(Isolate* isolate);
594  static ExternalReference compute_output_frames_function(Isolate* isolate);
595 
596  // Static data in the keyed lookup cache.
597  static ExternalReference keyed_lookup_cache_keys(Isolate* isolate);
598  static ExternalReference keyed_lookup_cache_field_offsets(Isolate* isolate);
599 
600  // Static variable Heap::roots_array_start()
601  static ExternalReference roots_array_start(Isolate* isolate);
602 
603  // Static variable StackGuard::address_of_jslimit()
604  static ExternalReference address_of_stack_limit(Isolate* isolate);
605 
606  // Static variable StackGuard::address_of_real_jslimit()
607  static ExternalReference address_of_real_stack_limit(Isolate* isolate);
608 
609  // Static variable RegExpStack::limit_address()
610  static ExternalReference address_of_regexp_stack_limit(Isolate* isolate);
611 
612  // Static variables for RegExp.
613  static ExternalReference address_of_static_offsets_vector(Isolate* isolate);
614  static ExternalReference address_of_regexp_stack_memory_address(
615  Isolate* isolate);
616  static ExternalReference address_of_regexp_stack_memory_size(
617  Isolate* isolate);
618 
619  // Static variable Heap::NewSpaceStart()
620  static ExternalReference new_space_start(Isolate* isolate);
621  static ExternalReference new_space_mask(Isolate* isolate);
622  static ExternalReference heap_always_allocate_scope_depth(Isolate* isolate);
623  static ExternalReference new_space_mark_bits(Isolate* isolate);
624 
625  // Write barrier.
626  static ExternalReference store_buffer_top(Isolate* isolate);
627 
628  // Used for fast allocation in generated code.
629  static ExternalReference new_space_allocation_top_address(Isolate* isolate);
630  static ExternalReference new_space_allocation_limit_address(Isolate* isolate);
631 
632  static ExternalReference double_fp_operation(Token::Value operation,
633  Isolate* isolate);
634  static ExternalReference compare_doubles(Isolate* isolate);
635  static ExternalReference power_double_double_function(Isolate* isolate);
636  static ExternalReference power_double_int_function(Isolate* isolate);
637 
638  static ExternalReference handle_scope_next_address();
639  static ExternalReference handle_scope_limit_address();
640  static ExternalReference handle_scope_level_address();
641 
642  static ExternalReference scheduled_exception_address(Isolate* isolate);
643  static ExternalReference address_of_pending_message_obj(Isolate* isolate);
644  static ExternalReference address_of_has_pending_message(Isolate* isolate);
645  static ExternalReference address_of_pending_message_script(Isolate* isolate);
646 
647  // Static variables containing common double constants.
648  static ExternalReference address_of_min_int();
649  static ExternalReference address_of_one_half();
650  static ExternalReference address_of_minus_zero();
651  static ExternalReference address_of_zero();
652  static ExternalReference address_of_uint8_max_value();
653  static ExternalReference address_of_negative_infinity();
654  static ExternalReference address_of_canonical_non_hole_nan();
655  static ExternalReference address_of_the_hole_nan();
656 
657  static ExternalReference math_sin_double_function(Isolate* isolate);
658  static ExternalReference math_cos_double_function(Isolate* isolate);
659  static ExternalReference math_tan_double_function(Isolate* isolate);
660  static ExternalReference math_log_double_function(Isolate* isolate);
661 
662  static ExternalReference page_flags(Page* page);
663 
664  Address address() const {return reinterpret_cast<Address>(address_);}
665 
666 #ifdef ENABLE_DEBUGGER_SUPPORT
667  // Function Debug::Break()
668  static ExternalReference debug_break(Isolate* isolate);
669 
670  // Used to check if single stepping is enabled in generated code.
671  static ExternalReference debug_step_in_fp_address(Isolate* isolate);
672 #endif
673 
674 #ifndef V8_INTERPRETED_REGEXP
675  // C functions called from RegExp generated code.
676 
677  // Function NativeRegExpMacroAssembler::CaseInsensitiveCompareUC16()
678  static ExternalReference re_case_insensitive_compare_uc16(Isolate* isolate);
679 
680  // Function RegExpMacroAssembler*::CheckStackGuardState()
681  static ExternalReference re_check_stack_guard_state(Isolate* isolate);
682 
683  // Function NativeRegExpMacroAssembler::GrowStack()
684  static ExternalReference re_grow_stack(Isolate* isolate);
685 
686  // byte NativeRegExpMacroAssembler::word_character_bitmap
687  static ExternalReference re_word_character_map();
688 
689 #endif
690 
691  // This lets you register a function that rewrites all external references.
692  // Used by the ARM simulator to catch calls to external references.
693  static void set_redirector(Isolate* isolate,
694  ExternalReferenceRedirector* redirector) {
695  // We can't stack them.
696  ASSERT(isolate->external_reference_redirector() == NULL);
697  isolate->set_external_reference_redirector(
698  reinterpret_cast<ExternalReferenceRedirectorPointer*>(redirector));
699  }
700 
701  private:
702  explicit ExternalReference(void* address)
703  : address_(address) {}
704 
705  static void* Redirect(Isolate* isolate,
706  void* address,
707  Type type = ExternalReference::BUILTIN_CALL) {
708  ExternalReferenceRedirector* redirector =
709  reinterpret_cast<ExternalReferenceRedirector*>(
710  isolate->external_reference_redirector());
711  if (redirector == NULL) return address;
712  void* answer = (*redirector)(address, type);
713  return answer;
714  }
715 
716  static void* Redirect(Isolate* isolate,
717  Address address_arg,
718  Type type = ExternalReference::BUILTIN_CALL) {
719  ExternalReferenceRedirector* redirector =
720  reinterpret_cast<ExternalReferenceRedirector*>(
721  isolate->external_reference_redirector());
722  void* address = reinterpret_cast<void*>(address_arg);
723  void* answer = (redirector == NULL) ?
724  address :
725  (*redirector)(address, type);
726  return answer;
727  }
728 
729  void* address_;
730 };
731 
732 
733 // -----------------------------------------------------------------------------
734 // Position recording support
735 
737  PositionState() : current_position(RelocInfo::kNoPosition),
738  written_position(RelocInfo::kNoPosition),
739  current_statement_position(RelocInfo::kNoPosition),
740  written_statement_position(RelocInfo::kNoPosition) {}
741 
744 
747 };
748 
749 
750 class PositionsRecorder BASE_EMBEDDED {
751  public:
752  explicit PositionsRecorder(Assembler* assembler)
753  : assembler_(assembler) {
754 #ifdef ENABLE_GDB_JIT_INTERFACE
755  gdbjit_lineinfo_ = NULL;
756 #endif
757  }
758 
759 #ifdef ENABLE_GDB_JIT_INTERFACE
760  ~PositionsRecorder() {
761  delete gdbjit_lineinfo_;
762  }
763 
764  void StartGDBJITLineInfoRecording() {
765  if (FLAG_gdbjit) {
766  gdbjit_lineinfo_ = new GDBJITLineInfo();
767  }
768  }
769 
770  GDBJITLineInfo* DetachGDBJITLineInfo() {
771  GDBJITLineInfo* lineinfo = gdbjit_lineinfo_;
772  gdbjit_lineinfo_ = NULL; // To prevent deallocation in destructor.
773  return lineinfo;
774  }
775 #endif
776 
777  // Set current position to pos.
778  void RecordPosition(int pos);
779 
780  // Set current statement position to pos.
781  void RecordStatementPosition(int pos);
782 
783  // Write recorded positions to relocation information.
784  bool WriteRecordedPositions();
785 
786  int current_position() const { return state_.current_position; }
787 
789  return state_.current_statement_position;
790  }
791 
792  private:
793  Assembler* assembler_;
794  PositionState state_;
795 #ifdef ENABLE_GDB_JIT_INTERFACE
796  GDBJITLineInfo* gdbjit_lineinfo_;
797 #endif
798 
799  friend class PreservePositionScope;
800 
801  DISALLOW_COPY_AND_ASSIGN(PositionsRecorder);
802 };
803 
804 
805 class PreservePositionScope BASE_EMBEDDED {
806  public:
807  explicit PreservePositionScope(PositionsRecorder* positions_recorder)
808  : positions_recorder_(positions_recorder),
809  saved_state_(positions_recorder->state_) {}
810 
812  positions_recorder_->state_ = saved_state_;
813  }
814 
815  private:
816  PositionsRecorder* positions_recorder_;
817  const PositionState saved_state_;
818 
819  DISALLOW_COPY_AND_ASSIGN(PreservePositionScope);
820 };
821 
822 
823 // -----------------------------------------------------------------------------
824 // Utility functions
825 
826 inline bool is_intn(int x, int n) {
827  return -(1 << (n-1)) <= x && x < (1 << (n-1));
828 }
829 
830 inline bool is_int8(int x) { return is_intn(x, 8); }
831 inline bool is_int16(int x) { return is_intn(x, 16); }
832 inline bool is_int18(int x) { return is_intn(x, 18); }
833 inline bool is_int24(int x) { return is_intn(x, 24); }
834 
835 inline bool is_uintn(int x, int n) {
836  return (x & -(1 << n)) == 0;
837 }
838 
839 inline bool is_uint2(int x) { return is_uintn(x, 2); }
840 inline bool is_uint3(int x) { return is_uintn(x, 3); }
841 inline bool is_uint4(int x) { return is_uintn(x, 4); }
842 inline bool is_uint5(int x) { return is_uintn(x, 5); }
843 inline bool is_uint6(int x) { return is_uintn(x, 6); }
844 inline bool is_uint8(int x) { return is_uintn(x, 8); }
845 inline bool is_uint10(int x) { return is_uintn(x, 10); }
846 inline bool is_uint12(int x) { return is_uintn(x, 12); }
847 inline bool is_uint16(int x) { return is_uintn(x, 16); }
848 inline bool is_uint24(int x) { return is_uintn(x, 24); }
849 inline bool is_uint26(int x) { return is_uintn(x, 26); }
850 inline bool is_uint28(int x) { return is_uintn(x, 28); }
851 
852 inline int NumberOfBitsSet(uint32_t x) {
853  unsigned int num_bits_set;
854  for (num_bits_set = 0; x; x >>= 1) {
855  num_bits_set += x & 1;
856  }
857  return num_bits_set;
858 }
859 
860 bool EvalComparison(Token::Value op, double op1, double op2);
861 
862 // Computes pow(x, y) with the special cases in the spec for Math.pow.
863 double power_double_int(double x, int y);
864 double power_double_double(double x, double y);
865 
866 // Helper class for generating code or data associated with the code
867 // right after a call instruction. As an example this can be used to
868 // generate safepoint data after calls for crankshaft.
869 class CallWrapper {
870  public:
872  virtual ~CallWrapper() { }
873  // Called just before emitting a call. Argument is the size of the generated
874  // call code.
875  virtual void BeforeCall(int call_size) const = 0;
876  // Called just after emitting a call, i.e., at the return site for the call.
877  virtual void AfterCall() const = 0;
878 };
879 
880 class NullCallWrapper : public CallWrapper {
881  public:
883  virtual ~NullCallWrapper() { }
884  virtual void BeforeCall(int call_size) const { }
885  virtual void AfterCall() const { }
886 };
887 
888 } } // namespace v8::internal
889 
890 #endif // V8_ASSEMBLER_H_
byte * Address
Definition: globals.h:172
RelocIterator(Code *code, int mode_mask=-1)
Definition: assembler.cc:545
static bool IsDebugBreakSlot(Mode mode)
Definition: assembler.h:255
Isolate * isolate() const
Definition: assembler.h:62
bool is_int24(int x)
Definition: assembler.h:833
int near_link_pos() const
Definition: assembler.h:108
static bool IsExternalReference(Mode mode)
Definition: assembler.h:249
RelocInfo(byte *pc, Mode rmode, intptr_t data, Code *host)
Definition: assembler.h:220
bool is_intn(int x, int n)
Definition: assembler.h:826
virtual void BeforeCall(int call_size) const =0
bool is_int18(int x)
Definition: assembler.h:832
bool is_uint26(int x)
Definition: assembler.h:849
static void set_redirector(Isolate *isolate, ExternalReferenceRedirector *redirector)
Definition: assembler.h:693
PositionsRecorder(Assembler *assembler)
Definition: assembler.h:752
byte * last_pc() const
Definition: assembler.h:396
value format" "after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false, "print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false, "print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false, "report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true, "garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true, "flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true, "use incremental marking") DEFINE_bool(incremental_marking_steps, true, "do incremental marking steps") DEFINE_bool(trace_incremental_marking, false, "trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true, "Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false, "Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true, "use inline caching") DEFINE_bool(native_code_counters, false, "generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false, "Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true, "Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false, "Never perform compaction on full GC-testing only") DEFINE_bool(compact_code_space, true, "Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true, "Flush inline caches prior to mark compact collection and" "flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0, "Default seed for initializing random generator" "(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true, "allows verbose printing") DEFINE_bool(allow_natives_syntax, false, "allow natives syntax") DEFINE_bool(trace_sim, false, "Trace simulator execution") DEFINE_bool(check_icache, false, "Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0, "Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8, "Stack alingment in bytes in simulator(4 or 8, 8 is default)") DEFINE_bool(trace_exception, false, "print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false, "preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true, "randomize hashes to avoid predictable hash collisions" "(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0, "Fixed seed to use to hash property keys(0 means random)" "(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false, "activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true, "generate optimized regexp code") DEFINE_bool(testing_bool_flag, true, "testing_bool_flag") DEFINE_int(testing_int_flag, 13, "testing_int_flag") DEFINE_float(testing_float_flag, 2.5, "float-flag") DEFINE_string(testing_string_flag, "Hello, world!", "string-flag") DEFINE_int(testing_prng_seed, 42, "Seed used for threading test randomness") DEFINE_string(testing_serialization_file, "/tmp/serdes", "file in which to serialize heap") DEFINE_bool(help, false, "Print usage message, including flags, on console") DEFINE_bool(dump_counters, false, "Dump counters on exit") DEFINE_string(map_counters, "", "Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT, "Pass all remaining arguments to the script.Alias for\"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#43"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2#define FLAG_MODE_DEFINE_DEFAULTS#1"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flag-definitions.h"1#define FLAG_FULL(ftype, ctype, nam, def, cmt)#define FLAG_READONLY(ftype, ctype, nam, def, cmt)#define DEFINE_implication(whenflag, thenflag)#define DEFINE_bool(nam, def, cmt)#define DEFINE_int(nam, def, cmt)#define DEFINE_float(nam, def, cmt)#define DEFINE_string(nam, def, cmt)#define DEFINE_args(nam, def, cmt)#define FLAG DEFINE_bool(use_strict, false,"enforce strict mode") DEFINE_bool(es5_readonly, false,"activate correct semantics for inheriting readonliness") DEFINE_bool(es52_globals, false,"activate new semantics for global var declarations") DEFINE_bool(harmony_typeof, false,"enable harmony semantics for typeof") DEFINE_bool(harmony_scoping, false,"enable harmony block scoping") DEFINE_bool(harmony_modules, false,"enable harmony modules (implies block scoping)") DEFINE_bool(harmony_proxies, false,"enable harmony proxies") DEFINE_bool(harmony_collections, false,"enable harmony collections (sets, maps, and weak maps)") DEFINE_bool(harmony, false,"enable all harmony features (except typeof)") DEFINE_implication(harmony, harmony_scoping) DEFINE_implication(harmony, harmony_modules) DEFINE_implication(harmony, harmony_proxies) DEFINE_implication(harmony, harmony_collections) DEFINE_implication(harmony_modules, harmony_scoping) DEFINE_bool(packed_arrays, false,"optimizes arrays that have no holes") DEFINE_bool(smi_only_arrays, true,"tracks arrays with only smi values") DEFINE_bool(clever_optimizations, true,"Optimize object size, Array shift, DOM strings and string +") DEFINE_bool(unbox_double_arrays, true,"automatically unbox arrays of doubles") DEFINE_bool(string_slices, true,"use string slices") DEFINE_bool(crankshaft, true,"use crankshaft") DEFINE_string(hydrogen_filter,"","optimization filter") DEFINE_bool(use_range, true,"use hydrogen range analysis") DEFINE_bool(eliminate_dead_phis, true,"eliminate dead phis") DEFINE_bool(use_gvn, true,"use hydrogen global value numbering") DEFINE_bool(use_canonicalizing, true,"use hydrogen instruction canonicalizing") DEFINE_bool(use_inlining, true,"use function inlining") DEFINE_int(max_inlined_source_size, 600,"maximum source size in bytes considered for a single inlining") DEFINE_int(max_inlined_nodes, 196,"maximum number of AST nodes considered for a single inlining") DEFINE_int(max_inlined_nodes_cumulative, 196,"maximum cumulative number of AST nodes considered for inlining") DEFINE_bool(loop_invariant_code_motion, true,"loop invariant code motion") DEFINE_bool(collect_megamorphic_maps_from_stub_cache, true,"crankshaft harvests type feedback from stub cache") DEFINE_bool(hydrogen_stats, false,"print statistics for hydrogen") DEFINE_bool(trace_hydrogen, false,"trace generated hydrogen to file") DEFINE_string(trace_phase,"Z","trace generated IR for specified phases") DEFINE_bool(trace_inlining, false,"trace inlining decisions") DEFINE_bool(trace_alloc, false,"trace register allocator") DEFINE_bool(trace_all_uses, false,"trace all use positions") DEFINE_bool(trace_range, false,"trace range analysis") DEFINE_bool(trace_gvn, false,"trace global value numbering") DEFINE_bool(trace_representation, false,"trace representation types") DEFINE_bool(stress_pointer_maps, false,"pointer map for every instruction") DEFINE_bool(stress_environments, false,"environment for every instruction") DEFINE_int(deopt_every_n_times, 0,"deoptimize every n times a deopt point is passed") DEFINE_bool(trap_on_deopt, false,"put a break point before deoptimizing") DEFINE_bool(deoptimize_uncommon_cases, true,"deoptimize uncommon cases") DEFINE_bool(polymorphic_inlining, true,"polymorphic inlining") DEFINE_bool(use_osr, true,"use on-stack replacement") DEFINE_bool(array_bounds_checks_elimination, false,"perform array bounds checks elimination") DEFINE_bool(array_index_dehoisting, false,"perform array index dehoisting") DEFINE_bool(trace_osr, false,"trace on-stack replacement") DEFINE_int(stress_runs, 0,"number of stress runs") DEFINE_bool(optimize_closures, true,"optimize closures") DEFINE_bool(inline_construct, true,"inline constructor calls") DEFINE_bool(inline_arguments, true,"inline functions with arguments object") DEFINE_int(loop_weight, 1,"loop weight for representation inference") DEFINE_bool(optimize_for_in, true,"optimize functions containing for-in loops") DEFINE_bool(experimental_profiler, true,"enable all profiler experiments") DEFINE_bool(watch_ic_patching, false,"profiler considers IC stability") DEFINE_int(frame_count, 1,"number of stack frames inspected by the profiler") DEFINE_bool(self_optimization, false,"primitive functions trigger their own optimization") DEFINE_bool(direct_self_opt, false,"call recompile stub directly when self-optimizing") DEFINE_bool(retry_self_opt, false,"re-try self-optimization if it failed") DEFINE_bool(count_based_interrupts, false,"trigger profiler ticks based on counting instead of timing") DEFINE_bool(interrupt_at_exit, false,"insert an interrupt check at function exit") DEFINE_bool(weighted_back_edges, false,"weight back edges by jump distance for interrupt triggering") DEFINE_int(interrupt_budget, 5900,"execution budget before interrupt is triggered") DEFINE_int(type_info_threshold, 15,"percentage of ICs that must have type info to allow optimization") DEFINE_int(self_opt_count, 130,"call count before self-optimization") DEFINE_implication(experimental_profiler, watch_ic_patching) DEFINE_implication(experimental_profiler, self_optimization) DEFINE_implication(experimental_profiler, retry_self_opt) DEFINE_implication(experimental_profiler, count_based_interrupts) DEFINE_implication(experimental_profiler, interrupt_at_exit) DEFINE_implication(experimental_profiler, weighted_back_edges) DEFINE_bool(trace_opt_verbose, false,"extra verbose compilation tracing") DEFINE_implication(trace_opt_verbose, trace_opt) DEFINE_bool(debug_code, false,"generate extra code (assertions) for debugging") DEFINE_bool(code_comments, false,"emit comments in code disassembly") DEFINE_bool(enable_sse2, true,"enable use of SSE2 instructions if available") DEFINE_bool(enable_sse3, true,"enable use of SSE3 instructions if available") DEFINE_bool(enable_sse4_1, true,"enable use of SSE4.1 instructions if available") DEFINE_bool(enable_cmov, true,"enable use of CMOV instruction if available") DEFINE_bool(enable_rdtsc, true,"enable use of RDTSC instruction if available") DEFINE_bool(enable_sahf, true,"enable use of SAHF instruction if available (X64 only)") DEFINE_bool(enable_vfp3, true,"enable use of VFP3 instructions if available - this implies ""enabling ARMv7 instructions (ARM only)") DEFINE_bool(enable_armv7, true,"enable use of ARMv7 instructions if available (ARM only)") DEFINE_bool(enable_fpu, true,"enable use of MIPS FPU instructions if available (MIPS only)") DEFINE_string(expose_natives_as, NULL,"expose natives in global object") DEFINE_string(expose_debug_as, NULL,"expose debug in global object") DEFINE_bool(expose_gc, false,"expose gc extension") DEFINE_bool(expose_externalize_string, false,"expose externalize string extension") DEFINE_int(stack_trace_limit, 10,"number of stack frames to capture") DEFINE_bool(builtins_in_stack_traces, false,"show built-in functions in stack traces") DEFINE_bool(disable_native_files, false,"disable builtin natives files") DEFINE_bool(inline_new, true,"use fast inline allocation") DEFINE_bool(stack_trace_on_abort, true,"print a stack trace if an assertion failure occurs") DEFINE_bool(trace, false,"trace function calls") DEFINE_bool(mask_constants_with_cookie, true,"use random jit cookie to mask large constants") DEFINE_bool(lazy, true,"use lazy compilation") DEFINE_bool(trace_opt, false,"trace lazy optimization") DEFINE_bool(trace_opt_stats, false,"trace lazy optimization statistics") DEFINE_bool(opt, true,"use adaptive optimizations") DEFINE_bool(always_opt, false,"always try to optimize functions") DEFINE_bool(prepare_always_opt, false,"prepare for turning on always opt") DEFINE_bool(trace_deopt, false,"trace deoptimization") DEFINE_int(min_preparse_length, 1024,"minimum length for automatic enable preparsing") DEFINE_bool(always_full_compiler, false,"try to use the dedicated run-once backend for all code") DEFINE_bool(trace_bailout, false,"print reasons for falling back to using the classic V8 backend") DEFINE_bool(compilation_cache, true,"enable compilation cache") DEFINE_bool(cache_prototype_transitions, true,"cache prototype transitions") DEFINE_bool(trace_debug_json, false,"trace debugging JSON request/response") DEFINE_bool(debugger_auto_break, true,"automatically set the debug break flag when debugger commands are ""in the queue") DEFINE_bool(enable_liveedit, true,"enable liveedit experimental feature") DEFINE_bool(break_on_abort, true,"always cause a debug break before aborting") DEFINE_int(stack_size, kPointerSize *123,"default size of stack region v8 is allowed to use (in kBytes)") DEFINE_int(max_stack_trace_source_length, 300,"maximum length of function source code printed in a stack trace.") DEFINE_bool(always_inline_smi_code, false,"always inline smi code in non-opt code") DEFINE_int(max_new_space_size, 0,"max size of the new generation (in kBytes)") DEFINE_int(max_old_space_size, 0,"max size of the old generation (in Mbytes)") DEFINE_int(max_executable_size, 0,"max size of executable memory (in Mbytes)") DEFINE_bool(gc_global, false,"always perform global GCs") DEFINE_int(gc_interval,-1,"garbage collect after <n> allocations") DEFINE_bool(trace_gc, false,"print one trace line following each garbage collection") DEFINE_bool(trace_gc_nvp, false,"print one detailed trace line in name=value format ""after each garbage collection") DEFINE_bool(print_cumulative_gc_stat, false,"print cumulative GC statistics in name=value format on exit") DEFINE_bool(trace_gc_verbose, false,"print more details following each garbage collection") DEFINE_bool(trace_fragmentation, false,"report fragmentation for old pointer and data pages") DEFINE_bool(collect_maps, true,"garbage collect maps from which no objects can be reached") DEFINE_bool(flush_code, true,"flush code that we expect not to use again before full gc") DEFINE_bool(incremental_marking, true,"use incremental marking") DEFINE_bool(incremental_marking_steps, true,"do incremental marking steps") DEFINE_bool(trace_incremental_marking, false,"trace progress of the incremental marking") DEFINE_bool(use_idle_notification, true,"Use idle notification to reduce memory footprint.") DEFINE_bool(send_idle_notification, false,"Send idle notifcation between stress runs.") DEFINE_bool(use_ic, true,"use inline caching") DEFINE_bool(native_code_counters, false,"generate extra code for manipulating stats counters") DEFINE_bool(always_compact, false,"Perform compaction on every full GC") DEFINE_bool(lazy_sweeping, true,"Use lazy sweeping for old pointer and data spaces") DEFINE_bool(never_compact, false,"Never perform compaction on full GC - testing only") DEFINE_bool(compact_code_space, true,"Compact code space on full non-incremental collections") DEFINE_bool(cleanup_code_caches_at_gc, true,"Flush inline caches prior to mark compact collection and ""flush code caches in maps during mark compact cycle.") DEFINE_int(random_seed, 0,"Default seed for initializing random generator ""(0, the default, means to use system random).") DEFINE_bool(use_verbose_printer, true,"allows verbose printing") DEFINE_bool(allow_natives_syntax, false,"allow natives syntax") DEFINE_bool(trace_sim, false,"Trace simulator execution") DEFINE_bool(check_icache, false,"Check icache flushes in ARM and MIPS simulator") DEFINE_int(stop_sim_at, 0,"Simulator stop after x number of instructions") DEFINE_int(sim_stack_alignment, 8,"Stack alingment in bytes in simulator (4 or 8, 8 is default)") DEFINE_bool(trace_exception, false,"print stack trace when throwing exceptions") DEFINE_bool(preallocate_message_memory, false,"preallocate some memory to build stack traces.") DEFINE_bool(randomize_hashes, true,"randomize hashes to avoid predictable hash collisions ""(with snapshots this option cannot override the baked-in seed)") DEFINE_int(hash_seed, 0,"Fixed seed to use to hash property keys (0 means random)""(with snapshots this option cannot override the baked-in seed)") DEFINE_bool(preemption, false,"activate a 100ms timer that switches between V8 threads") DEFINE_bool(regexp_optimization, true,"generate optimized regexp code") DEFINE_bool(testing_bool_flag, true,"testing_bool_flag") DEFINE_int(testing_int_flag, 13,"testing_int_flag") DEFINE_float(testing_float_flag, 2.5,"float-flag") DEFINE_string(testing_string_flag,"Hello, world!","string-flag") DEFINE_int(testing_prng_seed, 42,"Seed used for threading test randomness") DEFINE_string(testing_serialization_file,"/tmp/serdes","file in which to serialize heap") DEFINE_bool(help, false,"Print usage message, including flags, on console") DEFINE_bool(dump_counters, false,"Dump counters on exit") DEFINE_string(map_counters,"","Map counters to a file") DEFINE_args(js_arguments, JSARGUMENTS_INIT,"Pass all remaining arguments to the script. Alias for \"--\".") DEFINE_bool(debug_compile_events, true,"Enable debugger compile events") DEFINE_bool(debug_script_collected_events, true,"Enable debugger script collected events") DEFINE_bool(gdbjit, false,"enable GDBJIT interface (disables compacting GC)") DEFINE_bool(gdbjit_full, false,"enable GDBJIT interface for all code objects") DEFINE_bool(gdbjit_dump, false,"dump elf objects with debug info to disk") DEFINE_string(gdbjit_dump_filter,"","dump only objects containing this substring") DEFINE_bool(force_marking_deque_overflows, false,"force overflows of marking deque by reducing it's size ""to 64 words") DEFINE_bool(stress_compaction, false,"stress the GC compactor to flush out bugs (implies ""--force_marking_deque_overflows)")#define FLAG DEFINE_bool(enable_slow_asserts, false,"enable asserts that are slow to execute") DEFINE_bool(trace_codegen, false,"print name of functions for which code is generated") DEFINE_bool(print_source, false,"pretty print source code") DEFINE_bool(print_builtin_source, false,"pretty print source code for builtins") DEFINE_bool(print_ast, false,"print source AST") DEFINE_bool(print_builtin_ast, false,"print source AST for builtins") DEFINE_string(stop_at,"","function name where to insert a breakpoint") DEFINE_bool(print_builtin_scopes, false,"print scopes for builtins") DEFINE_bool(print_scopes, false,"print scopes") DEFINE_bool(trace_contexts, false,"trace contexts operations") DEFINE_bool(gc_greedy, false,"perform GC prior to some allocations") DEFINE_bool(gc_verbose, false,"print stuff during garbage collection") DEFINE_bool(heap_stats, false,"report heap statistics before and after GC") DEFINE_bool(code_stats, false,"report code statistics after GC") DEFINE_bool(verify_heap, false,"verify heap pointers before and after GC") DEFINE_bool(print_handles, false,"report handles after GC") DEFINE_bool(print_global_handles, false,"report global handles after GC") DEFINE_bool(trace_ic, false,"trace inline cache state transitions") DEFINE_bool(print_interfaces, false,"print interfaces") DEFINE_bool(print_interface_details, false,"print interface inference details") DEFINE_int(print_interface_depth, 5,"depth for printing interfaces") DEFINE_bool(trace_normalization, false,"prints when objects are turned into dictionaries.") DEFINE_bool(trace_lazy, false,"trace lazy compilation") DEFINE_bool(collect_heap_spill_statistics, false,"report heap spill statistics along with heap_stats ""(requires heap_stats)") DEFINE_bool(trace_isolates, false,"trace isolate state changes") DEFINE_bool(log_state_changes, false,"Log state changes.") DEFINE_bool(regexp_possessive_quantifier, false,"enable possessive quantifier syntax for testing") DEFINE_bool(trace_regexp_bytecodes, false,"trace regexp bytecode execution") DEFINE_bool(trace_regexp_assembler, false,"trace regexp macro assembler calls.")#define FLAG DEFINE_bool(log, false,"Minimal logging (no API, code, GC, suspect, or handles samples).") DEFINE_bool(log_all, false,"Log all events to the log file.") DEFINE_bool(log_runtime, false,"Activate runtime system %Log call.") DEFINE_bool(log_api, false,"Log API events to the log file.") DEFINE_bool(log_code, false,"Log code events to the log file without profiling.") DEFINE_bool(log_gc, false,"Log heap samples on garbage collection for the hp2ps tool.") DEFINE_bool(log_handles, false,"Log global handle events.") DEFINE_bool(log_snapshot_positions, false,"log positions of (de)serialized objects in the snapshot.") DEFINE_bool(log_suspect, false,"Log suspect operations.") DEFINE_bool(prof, false,"Log statistical profiling information (implies --log-code).") DEFINE_bool(prof_auto, true,"Used with --prof, starts profiling automatically") DEFINE_bool(prof_lazy, false,"Used with --prof, only does sampling and logging"" when profiler is active (implies --noprof_auto).") DEFINE_bool(prof_browser_mode, true,"Used with --prof, turns on browser-compatible mode for profiling.") DEFINE_bool(log_regexp, false,"Log regular expression execution.") DEFINE_bool(sliding_state_window, false,"Update sliding state window counters.") DEFINE_string(logfile,"v8.log","Specify the name of the log file.") DEFINE_bool(ll_prof, false,"Enable low-level linux profiler.")#define FLAG DEFINE_bool(trace_elements_transitions, false,"trace elements transitions") DEFINE_bool(print_code_stubs, false,"print code stubs") DEFINE_bool(test_secondary_stub_cache, false,"test secondary stub cache by disabling the primary one") DEFINE_bool(test_primary_stub_cache, false,"test primary stub cache by disabling the secondary one") DEFINE_bool(print_code, false,"print generated code") DEFINE_bool(print_opt_code, false,"print optimized code") DEFINE_bool(print_unopt_code, false,"print unoptimized code before ""printing optimized code based on it") DEFINE_bool(print_code_verbose, false,"print more information for code") DEFINE_bool(print_builtin_code, false,"print generated code for builtins")#47"/Users/thlorenz/dev/dx/v8-perf/build/v8/src/flags.cc"2 namespace{struct Flag{enum FlagType{TYPE_BOOL, TYPE_INT, TYPE_FLOAT, TYPE_STRING, TYPE_ARGS} name
Definition: flags.cc:1349
bool is_uint10(int x)
Definition: assembler.h:845
void * ExternalReferenceRedirector(void *original, Type type)
Definition: assembler.h:544
int current_statement_position() const
Definition: assembler.h:788
bool is_uint3(int x)
Definition: assembler.h:840
bool is_int8(int x)
Definition: assembler.h:830
bool is_uint24(int x)
Definition: assembler.h:848
#define ASSERT(condition)
Definition: checks.h:270
v8::Handle< v8::Value > Print(const v8::Arguments &args)
bool is_uint6(int x)
Definition: assembler.h:843
static bool IsComment(Mode mode)
Definition: assembler.h:240
Code * host() const
Definition: assembler.h:265
static void QuietNaN(HeapObject *nan)
Definition: assembler.h:67
bool is_uint12(int x)
Definition: assembler.h:846
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 instructions(ARM only)") DEFINE_bool(enable_armv7
uint8_t byte
Definition: globals.h:171
const unsigned kNoASTId
Definition: assembler.h:54
void Reposition(byte *pos, byte *pc)
Definition: assembler.h:402
PreservePositionScope(PositionsRecorder *positions_recorder)
Definition: assembler.h:807
static const int kApplyMask
Definition: assembler.h:354
const int kPointerSize
Definition: globals.h:234
double power_double_double(double x, double y)
Definition: assembler.cc:1179
bool is_uint5(int x)
Definition: assembler.h:842
bool is_uint16(int x)
Definition: assembler.h:847
virtual void AfterCall() const
Definition: assembler.h:885
#define DISALLOW_COPY_AND_ASSIGN(TypeName)
Definition: globals.h:321
static bool IsJSReturn(Mode mode)
Definition: assembler.h:237
const Register pc
static const int kMaxSmallPCDelta
Definition: assembler.h:185
double power_double_int(double x, int y)
Definition: assembler.cc:1164
#define BASE_EMBEDDED
Definition: allocation.h:68
static bool IsStatementPosition(Mode mode)
Definition: assembler.h:246
static bool IsEmbeddedObject(Mode mode)
Definition: assembler.h:230
INLINE(bool is_near_linked() const)
Definition: assembler.h:103
AssemblerBase(Isolate *isolate)
Definition: assembler.cc:109
bool is_uint2(int x)
Definition: assembler.h:839
static bool IsPosition(Mode mode)
Definition: assembler.h:243
bool is_int16(int x)
Definition: assembler.h:831
INLINE(static HeapObject *EnsureDoubleAligned(Heap *heap, HeapObject *object, int size))
static bool IsGCRelocMode(Mode mode)
Definition: assembler.h:234
static int ModeMask(Mode mode)
Definition: assembler.h:258
static bool IsCodeTarget(Mode mode)
Definition: assembler.h:227
activate correct semantics for inheriting readonliness enable harmony semantics for typeof enable harmony enable harmony proxies enable all harmony harmony_scoping harmony_proxies harmony_scoping tracks arrays with only smi values automatically unbox arrays of doubles use crankshaft use hydrogen range analysis use hydrogen global value numbering use function inlining maximum number of AST nodes considered for a single inlining loop invariant code motion print statistics for hydrogen trace generated IR for specified phases trace register allocator trace range analysis trace representation types environment for every instruction put a break point before deoptimizing polymorphic inlining perform array bounds checks elimination trace on stack replacement optimize closures functions with arguments object optimize functions containing for in loops profiler considers IC stability primitive functions trigger their own optimization re try self optimization if it failed insert an interrupt check at function exit execution budget before interrupt is triggered call count before self optimization self_optimization count_based_interrupts weighted_back_edges trace_opt emit comments in code disassembly enable use of SSE3 instructions if available enable use of CMOV instruction if available enable use of SAHF instruction if enable use of VFP3 instructions if available this implies enabling ARMv7 enable use of ARMv7 instructions if enable use of MIPS FPU instructions if NULL
Definition: flags.cc:274
static bool IsInternalReference(Mode mode)
Definition: assembler.h:252
RelocInfoWriter(byte *pos, byte *pc)
Definition: assembler.h:390
static bool IsConstructCall(Mode mode)
Definition: assembler.h:224
virtual void AfterCall() const =0
INLINE(bool is_unused() const)
Definition: assembler.h:101
bool is_uint28(int x)
Definition: assembler.h:850
bool is_uint8(int x)
Definition: assembler.h:844
Address address() const
Definition: assembler.h:664
virtual void BeforeCall(int call_size) const
Definition: assembler.h:884
INLINE(void UnuseNear())
Definition: assembler.h:98
int NumberOfBitsSet(uint32_t x)
Definition: assembler.h:852
INLINE(bool is_linked() const)
Definition: assembler.h:102
intptr_t data() const
Definition: assembler.h:264
bool EvalComparison(Token::Value op, double op1, double op2)
Definition: assembler.cc:1223
FlagType type() const
Definition: flags.cc:1358
bool is_uintn(int x, int n)
Definition: assembler.h:835
int current_position() const
Definition: assembler.h:786
INLINE(bool is_bound() const)
Definition: assembler.h:100
static const char *const kFillerCommentString
Definition: assembler.h:174
bool is_uint4(int x)
Definition: assembler.h:841