V8 Project
v8::internal::HGraphBuilder Class Referenceabstract

#include <hydrogen.h>

+ Inheritance diagram for v8::internal::HGraphBuilder:
+ Collaboration diagram for v8::internal::HGraphBuilder:

Classes

class  FINAL
 

Public Member Functions

 HGraphBuilder (CompilationInfo *info)
 
virtual ~HGraphBuilder ()
 
Scopescope () const
 
void set_scope (Scope *scope)
 
HBasicBlock * current_block () const
 
void set_current_block (HBasicBlock *block)
 
HEnvironment * environment () const
 
Zonezone () const
 
HGraph * graph () const
 
Isolateisolate () const
 
CompilationInfotop_info ()
 
HGraph * CreateGraph ()
 
void Push (HValue *value)
 
HValuePop ()
 
virtual HValuecontext ()=0
 
HInstructionAddInstruction (HInstruction *instr)
 
void FinishCurrentBlock (HControlInstruction *last)
 
void FinishExitCurrentBlock (HControlInstruction *instruction)
 
void Goto (HBasicBlock *from, HBasicBlock *target, FunctionState *state=NULL, bool add_simulate=true)
 
void Goto (HBasicBlock *target, FunctionState *state=NULL, bool add_simulate=true)
 
void GotoNoSimulate (HBasicBlock *from, HBasicBlock *target)
 
void GotoNoSimulate (HBasicBlock *target)
 
void AddLeaveInlined (HBasicBlock *block, HValue *return_value, FunctionState *state)
 
void AddLeaveInlined (HValue *return_value, FunctionState *state)
 
template<class I >
HInstructionNewUncasted ()
 
template<class I >
INew ()
 
template<class I >
HInstructionAddUncasted ()
 
template<class I >
IAdd ()
 
template<class I , class P1 >
HInstructionNewUncasted (P1 p1)
 
template<class I , class P1 >
INew (P1 p1)
 
template<class I , class P1 >
HInstructionAddUncasted (P1 p1)
 
template<class I , class P1 >
IAdd (P1 p1)
 
template<class I , class P1 , class P2 >
HInstructionNewUncasted (P1 p1, P2 p2)
 
template<class I , class P1 , class P2 >
INew (P1 p1, P2 p2)
 
template<class I , class P1 , class P2 >
HInstructionAddUncasted (P1 p1, P2 p2)
 
template<class I , class P1 , class P2 >
IAdd (P1 p1, P2 p2)
 
template<class I , class P1 , class P2 , class P3 >
HInstructionNewUncasted (P1 p1, P2 p2, P3 p3)
 
template<class I , class P1 , class P2 , class P3 >
INew (P1 p1, P2 p2, P3 p3)
 
template<class I , class P1 , class P2 , class P3 >
HInstructionAddUncasted (P1 p1, P2 p2, P3 p3)
 
template<class I , class P1 , class P2 , class P3 >
IAdd (P1 p1, P2 p2, P3 p3)
 
template<class I , class P1 , class P2 , class P3 , class P4 >
HInstructionNewUncasted (P1 p1, P2 p2, P3 p3, P4 p4)
 
template<class I , class P1 , class P2 , class P3 , class P4 >
INew (P1 p1, P2 p2, P3 p3, P4 p4)
 
template<class I , class P1 , class P2 , class P3 , class P4 >
HInstructionAddUncasted (P1 p1, P2 p2, P3 p3, P4 p4)
 
template<class I , class P1 , class P2 , class P3 , class P4 >
IAdd (P1 p1, P2 p2, P3 p3, P4 p4)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 >
HInstructionNewUncasted (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 >
INew (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 >
HInstructionAddUncasted (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 >
IAdd (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
HInstructionNewUncasted (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
INew (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
HInstructionAddUncasted (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
IAdd (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
HInstructionNewUncasted (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
INew (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
HInstructionAddUncasted (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
IAdd (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
HInstructionNewUncasted (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
INew (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
HInstructionAddUncasted (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
 
template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
IAdd (P1 p1, P2 p2, P3 p3, P4 p4, P5 p5, P6 p6, P7 p7, P8 p8)
 
void AddSimulate (BailoutId id, RemovableSimulate removable=FIXED_SIMULATE)
 
template<>
HDeoptimize * Add (const char *reason, Deoptimizer::BailoutType type)
 
template<>
HInstructionAddUncasted (const char *reason, Deoptimizer::BailoutType type)
 
template<>
HSimulate * Add (BailoutId id, RemovableSimulate removable)
 
template<>
HSimulate * Add (BailoutId id)
 
template<>
HInstructionAddUncasted (BailoutId id)
 
template<>
HReturn * Add (HValue *value)
 
template<>
HReturn * Add (HConstant *value)
 
template<>
HInstructionAddUncasted (HValue *value)
 
template<>
HInstructionAddUncasted (HConstant *value)
 
template<>
HCallRuntime * Add (Handle< String > name, const Runtime::Function *c_function, int argument_count)
 
template<>
HInstructionAddUncasted (Handle< String > name, const Runtime::Function *c_function, int argument_count)
 
template<>
HContext * New ()
 
template<>
HInstructionNewUncasted ()
 

Static Public Attributes

static const int kElementLoopUnrollThreshold = 8
 

Protected Member Functions

virtual bool BuildGraph ()=0
 
HBasicBlock * CreateBasicBlock (HEnvironment *env)
 
HBasicBlock * CreateLoopHeaderBlock ()
 
template<class BitFieldClass >
HValueBuildDecodeField (HValue *encoded_field)
 
HValueBuildGetElementsKind (HValue *object)
 
HValueBuildCheckHeapObject (HValue *object)
 
HValueBuildCheckString (HValue *string)
 
HValueBuildWrapReceiver (HValue *object, HValue *function)
 
HValueBuildCheckForCapacityGrow (HValue *object, HValue *elements, ElementsKind kind, HValue *length, HValue *key, bool is_js_array, PropertyAccessType access_type)
 
HValueBuildCopyElementsOnWrite (HValue *object, HValue *elements, ElementsKind kind, HValue *length)
 
void BuildTransitionElementsKind (HValue *object, HValue *map, ElementsKind from_kind, ElementsKind to_kind, bool is_jsarray)
 
HValueBuildNumberToString (HValue *object, Type *type)
 
void BuildJSObjectCheck (HValue *receiver, int bit_field_mask)
 
void BuildKeyedIndexCheck (HValue *key, HIfContinuation *join_continuation)
 
void BuildTestForDictionaryProperties (HValue *object, HIfContinuation *continuation)
 
void BuildNonGlobalObjectCheck (HValue *receiver)
 
HValueBuildKeyedLookupCacheHash (HValue *object, HValue *key)
 
HValueBuildUncheckedDictionaryElementLoad (HValue *receiver, HValue *elements, HValue *key, HValue *hash)
 
HValueBuildRegExpConstructResult (HValue *length, HValue *index, HValue *input)
 
HAllocate * BuildAllocate (HValue *object_size, HType type, InstanceType instance_type, HAllocationMode allocation_mode)
 
HValueBuildAddStringLengths (HValue *left_length, HValue *right_length)
 
HValueBuildCreateConsString (HValue *length, HValue *left, HValue *right, HAllocationMode allocation_mode)
 
void BuildCopySeqStringChars (HValue *src, HValue *src_offset, String::Encoding src_encoding, HValue *dst, HValue *dst_offset, String::Encoding dst_encoding, HValue *length)
 
HValueBuildObjectSizeAlignment (HValue *unaligned_size, int header_size)
 
HValueBuildUncheckedStringAdd (HValue *left, HValue *right, HAllocationMode allocation_mode)
 
HValueBuildStringAdd (HValue *left, HValue *right, HAllocationMode allocation_mode)
 
HInstructionBuildUncheckedMonomorphicElementAccess (HValue *checked_object, HValue *key, HValue *val, bool is_js_array, ElementsKind elements_kind, PropertyAccessType access_type, LoadKeyedHoleMode load_mode, KeyedAccessStoreMode store_mode)
 
HInstructionAddElementAccess (HValue *elements, HValue *checked_key, HValue *val, HValue *dependency, ElementsKind elements_kind, PropertyAccessType access_type, LoadKeyedHoleMode load_mode=NEVER_RETURN_HOLE)
 
HInstructionAddLoadStringInstanceType (HValue *string)
 
HInstructionAddLoadStringLength (HValue *string)
 
HStoreNamedField * AddStoreMapConstant (HValue *object, Handle< Map > map)
 
HLoadNamedField * AddLoadMap (HValue *object, HValue *dependency=NULL)
 
HLoadNamedField * AddLoadElements (HValue *object, HValue *dependency=NULL)
 
bool MatchRotateRight (HValue *left, HValue *right, HValue **operand, HValue **shift_amount)
 
HValueBuildBinaryOperation (Token::Value op, HValue *left, HValue *right, Type *left_type, Type *right_type, Type *result_type, Maybe< int > fixed_right_arg, HAllocationMode allocation_mode)
 
HLoadNamedField * AddLoadFixedArrayLength (HValue *object, HValue *dependency=NULL)
 
HLoadNamedField * AddLoadArrayLength (HValue *object, ElementsKind kind, HValue *dependency=NULL)
 
HValueAddLoadJSBuiltin (Builtins::JavaScript builtin)
 
HValueEnforceNumberType (HValue *number, Type *expected)
 
HValueTruncateToNumber (HValue *value, Type **expected)
 
void FinishExitWithHardDeoptimization (const char *reason)
 
void AddIncrementCounter (StatsCounter *counter)
 
HValueBuildNewElementsCapacity (HValue *old_capacity)
 
HValueBuildAllocateArrayFromLength (JSArrayBuilder *array_builder, HValue *length_argument)
 
HValueBuildCalculateElementsSize (ElementsKind kind, HValue *capacity)
 
HAllocate * AllocateJSArrayObject (AllocationSiteMode mode)
 
HConstant * EstablishElementsAllocationSize (ElementsKind kind, int capacity)
 
HAllocate * BuildAllocateElements (ElementsKind kind, HValue *size_in_bytes)
 
void BuildInitializeElementsHeader (HValue *elements, ElementsKind kind, HValue *capacity)
 
HValueBuildAllocateElementsAndInitializeElementsHeader (ElementsKind kind, HValue *capacity)
 
void BuildJSArrayHeader (HValue *array, HValue *array_map, HValue *elements, AllocationSiteMode mode, ElementsKind elements_kind, HValue *allocation_site_payload, HValue *length_field)
 
HValueBuildGrowElementsCapacity (HValue *object, HValue *elements, ElementsKind kind, ElementsKind new_kind, HValue *length, HValue *new_capacity)
 
void BuildFillElementsWithValue (HValue *elements, ElementsKind elements_kind, HValue *from, HValue *to, HValue *value)
 
void BuildFillElementsWithHole (HValue *elements, ElementsKind elements_kind, HValue *from, HValue *to)
 
void BuildCopyElements (HValue *from_elements, ElementsKind from_elements_kind, HValue *to_elements, ElementsKind to_elements_kind, HValue *length, HValue *capacity)
 
HValueBuildCloneShallowArrayCow (HValue *boilerplate, HValue *allocation_site, AllocationSiteMode mode, ElementsKind kind)
 
HValueBuildCloneShallowArrayEmpty (HValue *boilerplate, HValue *allocation_site, AllocationSiteMode mode)
 
HValueBuildCloneShallowArrayNonEmpty (HValue *boilerplate, HValue *allocation_site, AllocationSiteMode mode, ElementsKind kind)
 
HValueBuildElementIndexHash (HValue *index)
 
void BuildCompareNil (HValue *value, Type *type, HIfContinuation *continuation)
 
void BuildCreateAllocationMemento (HValue *previous_object, HValue *previous_object_size, HValue *payload)
 
HInstructionBuildConstantMapCheck (Handle< JSObject > constant)
 
HInstructionBuildCheckPrototypeMaps (Handle< JSObject > prototype, Handle< JSObject > holder)
 
HInstructionBuildGetNativeContext (HValue *closure)
 
HInstructionBuildGetNativeContext ()
 
HInstructionBuildGetArrayFunction ()
 
void SetSourcePosition (int position)
 
void EnterInlinedSource (int start_position, int id)
 
HSourcePosition ScriptPositionToSourcePosition (int position)
 
HSourcePosition source_position ()
 
void set_source_position (HSourcePosition position)
 
template<typename ViewClass >
void BuildArrayBufferViewInitialization (HValue *obj, HValue *buffer, HValue *byte_offset, HValue *byte_length)
 

Private Member Functions

 HGraphBuilder ()
 
template<class I >
IAddInstructionTyped (I *instr)
 

Private Attributes

CompilationInfoinfo_
 
HGraph * graph_
 
HBasicBlock * current_block_
 
Scopescope_
 
HSourcePosition position_
 
int start_position_
 

Detailed Description

Definition at line 1043 of file hydrogen.h.

Constructor & Destructor Documentation

◆ HGraphBuilder() [1/2]

v8::internal::HGraphBuilder::HGraphBuilder ( CompilationInfo info)
inlineexplicit

Definition at line 1045 of file hydrogen.h.

1046  : info_(info),
1047  graph_(NULL),
1049  scope_(info->scope()),
1051  start_position_(0) {}
HSourcePosition position_
Definition: hydrogen.h:1926
CompilationInfo * info_
Definition: hydrogen.h:1922
HBasicBlock * current_block_
Definition: hydrogen.h:1924
static HSourcePosition Unknown()
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be NULL

◆ ~HGraphBuilder()

virtual v8::internal::HGraphBuilder::~HGraphBuilder ( )
inlinevirtual

Definition at line 1052 of file hydrogen.h.

1052 {}

◆ HGraphBuilder() [2/2]

v8::internal::HGraphBuilder::HGraphBuilder ( )
private

Member Function Documentation

◆ Add() [1/15]

template<class I >
I* v8::internal::HGraphBuilder::Add ( )
inline

Definition at line 1116 of file hydrogen.h.

1116 { return AddInstructionTyped(New<I>());}
I * AddInstructionTyped(I *instr)
Definition: hydrogen.h:1918

References AddInstructionTyped().

Referenced by v8::internal::HOsrBuilder::BuildOsrLoopEntry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Add() [2/15]

template<>
HSimulate* v8::internal::HGraphBuilder::Add ( BailoutId  id)
inline

Definition at line 1969 of file hydrogen.h.

1970  {
1971  return Add<HSimulate>(id, FIXED_SIMULATE);
1972 }

References v8::internal::FIXED_SIMULATE.

◆ Add() [3/15]

template<>
HSimulate* v8::internal::HGraphBuilder::Add ( BailoutId  id,
RemovableSimulate  removable 
)
inline

Definition at line 1959 of file hydrogen.h.

1961  {
1962  HSimulate* instr = current_block()->CreateSimulate(id, removable);
1963  AddInstruction(instr);
1964  return instr;
1965 }
HInstruction * AddInstruction(HInstruction *instr)
Definition: hydrogen.cc:1185
HBasicBlock * current_block() const
Definition: hydrogen.h:1057

References AddInstruction(), and current_block().

+ Here is the call graph for this function:

◆ Add() [4/15]

template<>
HDeoptimize* v8::internal::HGraphBuilder::Add ( const char *  reason,
Deoptimizer::BailoutType  type 
)
inline

Definition at line 1932 of file hydrogen.h.

1933  {
1934  if (type == Deoptimizer::SOFT) {
1935  isolate()->counters()->soft_deopts_requested()->Increment();
1936  if (FLAG_always_opt) return NULL;
1937  }
1938  if (current_block()->IsDeoptimizing()) return NULL;
1939  HBasicBlock* after_deopt_block = CreateBasicBlock(
1940  current_block()->last_environment());
1941  HDeoptimize* instr = New<HDeoptimize>(reason, type, after_deopt_block);
1942  if (type == Deoptimizer::SOFT) {
1943  isolate()->counters()->soft_deopts_inserted()->Increment();
1944  }
1945  FinishCurrentBlock(instr);
1946  set_current_block(after_deopt_block);
1947  return instr;
1948 }
void set_current_block(HBasicBlock *block)
Definition: hydrogen.h:1058
HBasicBlock * CreateBasicBlock(HEnvironment *env)
Definition: hydrogen.cc:1240
Isolate * isolate() const
Definition: hydrogen.h:1064
void FinishCurrentBlock(HControlInstruction *last)
Definition: hydrogen.cc:1198
Counters * counters()
Definition: isolate.h:857

References v8::internal::Isolate::counters(), CreateBasicBlock(), current_block(), FinishCurrentBlock(), isolate(), NULL, set_current_block(), and v8::internal::Deoptimizer::SOFT.

+ Here is the call graph for this function:

◆ Add() [5/15]

template<>
HCallRuntime* v8::internal::HGraphBuilder::Add ( Handle< String name,
const Runtime::Function c_function,
int  argument_count 
)
inline

Definition at line 2009 of file hydrogen.h.

2012  {
2013  HCallRuntime* instr = New<HCallRuntime>(name, c_function, argument_count);
2014  if (graph()->info()->IsStub()) {
2015  // When compiling code stubs, we don't want to save all double registers
2016  // upon entry to the stub, but instead have the call runtime instruction
2017  // save the double registers only on-demand (in the fallback case).
2018  instr->set_save_doubles(kSaveFPRegs);
2019  }
2020  AddInstruction(instr);
2021  return instr;
2022 }
HGraph * graph() const
Definition: hydrogen.h:1063
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in name

References AddInstruction(), graph(), v8::internal::kSaveFPRegs, and name.

+ Here is the call graph for this function:

◆ Add() [6/15]

template<>
HReturn* v8::internal::HGraphBuilder::Add ( HConstant *  value)
inline

Definition at line 1992 of file hydrogen.h.

1992  {
1993  return Add<HReturn>(static_cast<HValue*>(value));
1994 }

◆ Add() [7/15]

template<>
HReturn* v8::internal::HGraphBuilder::Add ( HValue value)
inline

Definition at line 1982 of file hydrogen.h.

1982  {
1983  int num_parameters = graph()->info()->num_parameters();
1984  HValue* params = AddUncasted<HConstant>(num_parameters);
1985  HReturn* return_instruction = New<HReturn>(value, params);
1986  FinishExitCurrentBlock(return_instruction);
1987  return return_instruction;
1988 }
void FinishExitCurrentBlock(HControlInstruction *instruction)
Definition: hydrogen.cc:1209

References FinishExitCurrentBlock(), and graph().

+ Here is the call graph for this function:

◆ Add() [8/15]

template<class I , class P1 >
I* v8::internal::HGraphBuilder::Add ( P1  p1)
inline

Definition at line 1137 of file hydrogen.h.

1137  {
1138  I* result = AddInstructionTyped(New<I>(p1));
1139  // Specializations must have their parameters properly casted
1140  // to avoid landing here.
1141  DCHECK(!result->IsReturn() && !result->IsSimulate() &&
1142  !result->IsDeoptimize());
1143  return result;
1144  }
#define DCHECK(condition)
Definition: logging.h:205

References AddInstructionTyped(), DCHECK, v8::internal::I, and v8::internal::p1.

+ Here is the call graph for this function:

◆ Add() [9/15]

template<class I , class P1 , class P2 >
I* v8::internal::HGraphBuilder::Add ( P1  p1,
P2  p2 
)
inline

Definition at line 1166 of file hydrogen.h.

1166  {
1167  I* result = AddInstructionTyped(New<I>(p1, p2));
1168  // Specializations must have their parameters properly casted
1169  // to avoid landing here.
1170  DCHECK(!result->IsSimulate());
1171  return result;
1172  }

References AddInstructionTyped(), DCHECK, v8::internal::I, v8::internal::p1, and v8::internal::p2.

+ Here is the call graph for this function:

◆ Add() [10/15]

template<class I , class P1 , class P2 , class P3 >
I* v8::internal::HGraphBuilder::Add ( P1  p1,
P2  p2,
P3  p3 
)
inline

Definition at line 1190 of file hydrogen.h.

1190  {
1191  return AddInstructionTyped(New<I>(p1, p2, p3));
1192  }

References AddInstructionTyped(), v8::internal::p1, v8::internal::p2, and v8::internal::p3.

+ Here is the call graph for this function:

◆ Add() [11/15]

template<class I , class P1 , class P2 , class P3 , class P4 >
I* v8::internal::HGraphBuilder::Add ( P1  p1,
P2  p2,
P3  p3,
P4  p4 
)
inline

Definition at line 1210 of file hydrogen.h.

1210  {
1211  return AddInstructionTyped(New<I>(p1, p2, p3, p4));
1212  }

References AddInstructionTyped(), v8::internal::p1, v8::internal::p2, v8::internal::p3, and v8::internal::p4.

+ Here is the call graph for this function:

◆ Add() [12/15]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 >
I* v8::internal::HGraphBuilder::Add ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
)
inline

Definition at line 1230 of file hydrogen.h.

1230  {
1231  return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5));
1232  }

References AddInstructionTyped(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, and v8::internal::p5.

+ Here is the call graph for this function:

◆ Add() [13/15]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
I* v8::internal::HGraphBuilder::Add ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6 
)
inline

Definition at line 1250 of file hydrogen.h.

1250  {
1251  return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6));
1252  }

References AddInstructionTyped(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, and v8::internal::p6.

+ Here is the call graph for this function:

◆ Add() [14/15]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
I* v8::internal::HGraphBuilder::Add ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7 
)
inline

Definition at line 1274 of file hydrogen.h.

1274  {
1275  return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7));
1276  }

References AddInstructionTyped(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, and v8::internal::p7.

+ Here is the call graph for this function:

◆ Add() [15/15]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
I* v8::internal::HGraphBuilder::Add ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7,
P8  p8 
)
inline

Definition at line 1300 of file hydrogen.h.

1300  {
1301  return AddInstructionTyped(New<I>(p1, p2, p3, p4, p5, p6, p7, p8));
1302  }

References AddInstructionTyped(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, v8::internal::p7, and v8::internal::p8.

+ Here is the call graph for this function:

◆ AddElementAccess()

HInstruction * v8::internal::HGraphBuilder::AddElementAccess ( HValue elements,
HValue checked_key,
HValue val,
HValue dependency,
ElementsKind  elements_kind,
PropertyAccessType  access_type,
LoadKeyedHoleMode  load_mode = NEVER_RETURN_HOLE 
)
protected

Definition at line 2671 of file hydrogen.cc.

2678  {
2679  if (access_type == STORE) {
2680  DCHECK(val != NULL);
2681  if (elements_kind == EXTERNAL_UINT8_CLAMPED_ELEMENTS ||
2682  elements_kind == UINT8_CLAMPED_ELEMENTS) {
2683  val = Add<HClampToUint8>(val);
2684  }
2685  return Add<HStoreKeyed>(elements, checked_key, val, elements_kind,
2687  }
2688 
2689  DCHECK(access_type == LOAD);
2690  DCHECK(val == NULL);
2691  HLoadKeyed* load = Add<HLoadKeyed>(
2692  elements, checked_key, dependency, elements_kind, load_mode);
2693  if (FLAG_opt_safe_uint32_operations &&
2694  (elements_kind == EXTERNAL_UINT32_ELEMENTS ||
2695  elements_kind == UINT32_ELEMENTS)) {
2696  graph()->RecordUint32Instruction(load);
2697  }
2698  return load;
2699 }
@ UINT8_CLAMPED_ELEMENTS
Definition: elements-kind.h:52
@ EXTERNAL_UINT32_ELEMENTS
Definition: elements-kind.h:38
@ EXTERNAL_UINT8_CLAMPED_ELEMENTS
Definition: elements-kind.h:41

References DCHECK, v8::internal::EXTERNAL_UINT32_ELEMENTS, v8::internal::EXTERNAL_UINT8_CLAMPED_ELEMENTS, LOAD, NULL, STORE, v8::internal::STORE_TO_INITIALIZED_ENTRY, v8::internal::UINT32_ELEMENTS, and v8::internal::UINT8_CLAMPED_ELEMENTS.

Referenced by v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall().

+ Here is the caller graph for this function:

◆ AddIncrementCounter()

void v8::internal::HGraphBuilder::AddIncrementCounter ( StatsCounter counter)
protected

Definition at line 1219 of file hydrogen.cc.

1219  {
1220  if (FLAG_native_code_counters && counter->Enabled()) {
1221  HValue* reference = Add<HConstant>(ExternalReference(counter));
1222  HValue* old_value = Add<HLoadNamedField>(
1223  reference, static_cast<HValue*>(NULL), HObjectAccess::ForCounter());
1224  HValue* new_value = AddUncasted<HAdd>(old_value, graph()->GetConstant1());
1225  new_value->ClearFlag(HValue::kCanOverflow); // Ignore counter overflow
1226  Add<HStoreNamedField>(reference, HObjectAccess::ForCounter(),
1227  new_value, STORE_TO_INITIALIZED_ENTRY);
1228  }
1229 }

References v8::internal::HValue::ClearFlag(), v8::internal::StatsCounter::Enabled(), NULL, and v8::internal::STORE_TO_INITIALIZED_ENTRY.

Referenced by v8::internal::CodeStubGraphBuilderBase::BuildCheckAndInstallOptimizedCode(), and v8::internal::CodeStubGraphBuilderBase::BuildInstallFromOptimizedCodeMap().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddInstruction()

HInstruction * v8::internal::HGraphBuilder::AddInstruction ( HInstruction instr)

Definition at line 1185 of file hydrogen.cc.

1185  {
1186  DCHECK(current_block() != NULL);
1187  DCHECK(!FLAG_hydrogen_track_positions ||
1188  !position_.IsUnknown() ||
1189  !info_->IsOptimizing());
1190  current_block()->AddInstruction(instr, source_position());
1191  if (graph()->IsInsideNoSideEffectsScope()) {
1192  instr->SetFlag(HValue::kHasNoObservableSideEffects);
1193  }
1194  return instr;
1195 }
HSourcePosition source_position()
Definition: hydrogen.h:1903

References DCHECK, NULL, and v8::internal::HValue::SetFlag().

Referenced by Add(), AddInstructionTyped(), AddUncasted(), v8::internal::HOptimizedGraphBuilder::BuildLoad(), v8::internal::HOptimizedGraphBuilder::BuildStore(), v8::internal::HOptimizedGraphBuilder::HandleKeyedElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(), v8::internal::HOptimizedGraphBuilder::PushArgumentsFromEnvironment(), v8::internal::HOptimizedGraphBuilder::SetUpScope(), TruncateToNumber(), and v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddInstructionTyped()

template<class I >
I* v8::internal::HGraphBuilder::AddInstructionTyped ( I instr)
inlineprivate

Definition at line 1918 of file hydrogen.h.

1918  {
1919  return I::cast(AddInstruction(instr));
1920  }

References AddInstruction().

Referenced by Add().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddLeaveInlined() [1/2]

void v8::internal::HGraphBuilder::AddLeaveInlined ( HBasicBlock *  block,
HValue return_value,
FunctionState *  state 
)
inline

Definition at line 1097 of file hydrogen.h.

1099  {
1100  block->AddLeaveInlined(return_value, state, source_position());
1101  }

References source_position().

Referenced by AddLeaveInlined(), and v8::internal::HOptimizedGraphBuilder::TryInline().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddLeaveInlined() [2/2]

void v8::internal::HGraphBuilder::AddLeaveInlined ( HValue return_value,
FunctionState *  state 
)
inline

Definition at line 1102 of file hydrogen.h.

1102  {
1103  return AddLeaveInlined(current_block(), return_value, state);
1104  }
void AddLeaveInlined(HBasicBlock *block, HValue *return_value, FunctionState *state)
Definition: hydrogen.h:1097

References AddLeaveInlined(), and current_block().

+ Here is the call graph for this function:

◆ AddLoadArrayLength()

HLoadNamedField * v8::internal::HGraphBuilder::AddLoadArrayLength ( HValue object,
ElementsKind  kind,
HValue dependency = NULL 
)
protected

Definition at line 2723 of file hydrogen.cc.

2725  {
2726  return Add<HLoadNamedField>(
2727  array, dependency, HObjectAccess::ForArrayLength(kind));
2728 }

Referenced by v8::internal::HOptimizedGraphBuilder::BuildArrayIndexOf().

+ Here is the caller graph for this function:

◆ AddLoadElements()

HLoadNamedField * v8::internal::HGraphBuilder::AddLoadElements ( HValue object,
HValue dependency = NULL 
)
protected

Definition at line 2708 of file hydrogen.cc.

2709  {
2710  return Add<HLoadNamedField>(
2711  object, dependency, HObjectAccess::ForElementsPointer());
2712 }

Referenced by v8::internal::HOptimizedGraphBuilder::BuildArrayIndexOf(), v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub(), and v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall().

+ Here is the caller graph for this function:

◆ AddLoadFixedArrayLength()

HLoadNamedField * v8::internal::HGraphBuilder::AddLoadFixedArrayLength ( HValue object,
HValue dependency = NULL 
)
protected

Definition at line 2715 of file hydrogen.cc.

2717  {
2718  return Add<HLoadNamedField>(
2719  array, dependency, HObjectAccess::ForFixedArrayLength());
2720 }

◆ AddLoadJSBuiltin()

HValue * v8::internal::HGraphBuilder::AddLoadJSBuiltin ( Builtins::JavaScript  builtin)
protected

Definition at line 3306 of file hydrogen.cc.

3306  {
3307  HValue* global_object = Add<HLoadNamedField>(
3308  context(), static_cast<HValue*>(NULL),
3309  HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
3310  HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(
3312  HValue* builtins = Add<HLoadNamedField>(
3313  global_object, static_cast<HValue*>(NULL), access);
3314  HObjectAccess function_access = HObjectAccess::ForObservableJSObjectOffset(
3316  return Add<HLoadNamedField>(
3317  builtins, static_cast<HValue*>(NULL), function_access);
3318 }
static const int kBuiltinsOffset
Definition: objects.h:7458
virtual HValue * context()=0
static int OffsetOfFunctionWithId(Builtins::JavaScript id)
Definition: objects.h:7520

References context(), v8::internal::Context::GLOBAL_OBJECT_INDEX, v8::internal::GlobalObject::kBuiltinsOffset, NULL, and v8::internal::JSBuiltinsObject::OffsetOfFunctionWithId().

Referenced by BuildBinaryOperation(), and v8::internal::HOptimizedGraphBuilder::VisitDelete().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ AddLoadMap()

HLoadNamedField * v8::internal::HGraphBuilder::AddLoadMap ( HValue object,
HValue dependency = NULL 
)
protected

Definition at line 2702 of file hydrogen.cc.

2703  {
2704  return Add<HLoadNamedField>(object, dependency, HObjectAccess::ForMap());
2705 }

◆ AddLoadStringInstanceType()

HInstruction * v8::internal::HGraphBuilder::AddLoadStringInstanceType ( HValue string)
protected

Definition at line 6793 of file hydrogen.cc.

6793  {
6794  if (string->IsConstant()) {
6795  HConstant* c_string = HConstant::cast(string);
6796  if (c_string->HasStringValue()) {
6797  return Add<HConstant>(c_string->StringValue()->map()->instance_type());
6798  }
6799  }
6800  return Add<HLoadNamedField>(
6801  Add<HLoadNamedField>(string, static_cast<HValue*>(NULL),
6802  HObjectAccess::ForMap()),
6803  static_cast<HValue*>(NULL), HObjectAccess::ForMapInstanceType());
6804 }

References NULL.

◆ AddLoadStringLength()

HInstruction * v8::internal::HGraphBuilder::AddLoadStringLength ( HValue string)
protected

Definition at line 6807 of file hydrogen.cc.

6807  {
6808  if (string->IsConstant()) {
6809  HConstant* c_string = HConstant::cast(string);
6810  if (c_string->HasStringValue()) {
6811  return Add<HConstant>(c_string->StringValue()->length());
6812  }
6813  }
6814  return Add<HLoadNamedField>(string, static_cast<HValue*>(NULL),
6815  HObjectAccess::ForStringLength());
6816 }

References NULL.

Referenced by v8::internal::HOptimizedGraphBuilder::BuildStringCharCodeAt().

+ Here is the caller graph for this function:

◆ AddSimulate()

void v8::internal::HGraphBuilder::AddSimulate ( BailoutId  id,
RemovableSimulate  removable = FIXED_SIMULATE 
)

Definition at line 1232 of file hydrogen.cc.

1233  {
1234  DCHECK(current_block() != NULL);
1235  DCHECK(!graph()->IsInsideNoSideEffectsScope());
1236  current_block()->AddNewSimulate(id, source_position(), removable);
1237 }

References DCHECK, and NULL.

Referenced by v8::internal::HOptimizedGraphBuilder::BuildCompareInstruction(), and v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed().

+ Here is the caller graph for this function:

◆ AddStoreMapConstant()

HStoreNamedField* v8::internal::HGraphBuilder::AddStoreMapConstant ( HValue object,
Handle< Map map 
)
inlineprotected

Definition at line 1438 of file hydrogen.h.

1438  {
1439  return Add<HStoreNamedField>(object, HObjectAccess::ForMap(),
1440  Add<HConstant>(map));
1441  }
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf map

References map.

Referenced by v8::internal::HOptimizedGraphBuilder::BuildAllocateExternalElements(), v8::internal::HOptimizedGraphBuilder::BuildAllocateFixedTypedArray(), v8::internal::HOptimizedGraphBuilder::BuildEmitInObjectProperties(), v8::internal::HOptimizedGraphBuilder::BuildEmitObjectHeader(), and v8::internal::HOptimizedGraphBuilder::BuildStoreNamedField().

+ Here is the caller graph for this function:

◆ AddUncasted() [1/14]

template<class I >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( )
inline

Definition at line 1113 of file hydrogen.h.

1113 { return AddInstruction(NewUncasted<I>());}

References AddInstruction().

+ Here is the call graph for this function:

◆ AddUncasted() [2/14]

template<>
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( BailoutId  id)
inline

Definition at line 1976 of file hydrogen.h.

1976  {
1977  return Add<HSimulate>(id, FIXED_SIMULATE);
1978 }

References v8::internal::FIXED_SIMULATE.

◆ AddUncasted() [3/14]

template<>
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( const char *  reason,
Deoptimizer::BailoutType  type 
)
inline

Definition at line 1952 of file hydrogen.h.

1953  {
1954  return Add<HDeoptimize>(reason, type);
1955 }

◆ AddUncasted() [4/14]

template<>
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( Handle< String name,
const Runtime::Function c_function,
int  argument_count 
)
inline

Definition at line 2026 of file hydrogen.h.

2029  {
2030  return Add<HCallRuntime>(name, c_function, argument_count);
2031 }

References name.

◆ AddUncasted() [5/14]

template<>
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( HConstant *  value)
inline

Definition at line 2003 of file hydrogen.h.

2003  {
2004  return Add<HReturn>(value);
2005 }

◆ AddUncasted() [6/14]

template<>
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( HValue value)
inline

Definition at line 1997 of file hydrogen.h.

1997  {
1998  return Add<HReturn>(value);
1999 }

◆ AddUncasted() [7/14]

template<class I , class P1 >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( P1  p1)
inline

Definition at line 1127 of file hydrogen.h.

1127  {
1128  HInstruction* result = AddInstruction(NewUncasted<I>(p1));
1129  // Specializations must have their parameters properly casted
1130  // to avoid landing here.
1131  DCHECK(!result->IsReturn() && !result->IsSimulate() &&
1132  !result->IsDeoptimize());
1133  return result;
1134  }

References AddInstruction(), DCHECK, and v8::internal::p1.

+ Here is the call graph for this function:

◆ AddUncasted() [8/14]

template<class I , class P1 , class P2 >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( P1  p1,
P2  p2 
)
inline

Definition at line 1157 of file hydrogen.h.

1157  {
1158  HInstruction* result = AddInstruction(NewUncasted<I>(p1, p2));
1159  // Specializations must have their parameters properly casted
1160  // to avoid landing here.
1161  DCHECK(!result->IsSimulate());
1162  return result;
1163  }

References AddInstruction(), DCHECK, v8::internal::p1, and v8::internal::p2.

+ Here is the call graph for this function:

◆ AddUncasted() [9/14]

template<class I , class P1 , class P2 , class P3 >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( P1  p1,
P2  p2,
P3  p3 
)
inline

Definition at line 1185 of file hydrogen.h.

1185  {
1186  return AddInstruction(NewUncasted<I>(p1, p2, p3));
1187  }

References AddInstruction(), v8::internal::p1, v8::internal::p2, and v8::internal::p3.

+ Here is the call graph for this function:

◆ AddUncasted() [10/14]

template<class I , class P1 , class P2 , class P3 , class P4 >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4 
)
inline

Definition at line 1205 of file hydrogen.h.

1205  {
1206  return AddInstruction(NewUncasted<I>(p1, p2, p3, p4));
1207  }

References AddInstruction(), v8::internal::p1, v8::internal::p2, v8::internal::p3, and v8::internal::p4.

+ Here is the call graph for this function:

◆ AddUncasted() [11/14]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
)
inline

Definition at line 1225 of file hydrogen.h.

1225  {
1226  return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5));
1227  }

References AddInstruction(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, and v8::internal::p5.

+ Here is the call graph for this function:

◆ AddUncasted() [12/14]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6 
)
inline

Definition at line 1245 of file hydrogen.h.

1245  {
1246  return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6));
1247  }

References AddInstruction(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, and v8::internal::p6.

+ Here is the call graph for this function:

◆ AddUncasted() [13/14]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7 
)
inline

Definition at line 1268 of file hydrogen.h.

1268  {
1269  return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7));
1270  }

References AddInstruction(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, and v8::internal::p7.

+ Here is the call graph for this function:

◆ AddUncasted() [14/14]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
HInstruction* v8::internal::HGraphBuilder::AddUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7,
P8  p8 
)
inline

Definition at line 1293 of file hydrogen.h.

1294  {
1295  return AddInstruction(NewUncasted<I>(p1, p2, p3, p4, p5, p6, p7, p8));
1296  }

References AddInstruction(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, v8::internal::p7, and v8::internal::p8.

+ Here is the call graph for this function:

◆ AllocateJSArrayObject()

HAllocate * v8::internal::HGraphBuilder::AllocateJSArrayObject ( AllocationSiteMode  mode)
protected

Definition at line 2582 of file hydrogen.cc.

2582  {
2583  int base_size = JSArray::kSize;
2584  if (mode == TRACK_ALLOCATION_SITE) {
2585  base_size += AllocationMemento::kSize;
2586  }
2587  HConstant* size_in_bytes = Add<HConstant>(base_size);
2588  return Add<HAllocate>(
2589  size_in_bytes, HType::JSArray(), NOT_TENURED, JS_OBJECT_TYPE);
2590 }
static const int kSize
Definition: objects.h:10073
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long mode(MIPS only)") DEFINE_BOOL(enable_always_align_csp
@ TRACK_ALLOCATION_SITE
Definition: objects.h:8085
@ JS_OBJECT_TYPE
Definition: objects.h:731

References v8::internal::JS_OBJECT_TYPE, mode(), v8::internal::NOT_TENURED, and v8::internal::TRACK_ALLOCATION_SITE.

+ Here is the call graph for this function:

◆ BuildAddStringLengths()

HValue * v8::internal::HGraphBuilder::BuildAddStringLengths ( HValue left_length,
HValue right_length 
)
protected

Definition at line 2050 of file hydrogen.cc.

2051  {
2052  // Compute the combined string length and check against max string length.
2053  HValue* length = AddUncasted<HAdd>(left_length, right_length);
2054  // Check that length <= kMaxLength <=> length < MaxLength + 1.
2055  HValue* max_length = Add<HConstant>(String::kMaxLength + 1);
2056  Add<HBoundsCheck>(length, max_length);
2057  return length;
2058 }
static const int kMaxLength
Definition: objects.h:8820

◆ BuildAllocate()

HAllocate * v8::internal::HGraphBuilder::BuildAllocate ( HValue object_size,
HType  type,
InstanceType  instance_type,
HAllocationMode  allocation_mode 
)
protected

Definition at line 2023 of file hydrogen.cc.

2027  {
2028  // Compute the effective allocation size.
2029  HValue* size = object_size;
2030  if (allocation_mode.CreateAllocationMementos()) {
2031  size = AddUncasted<HAdd>(size, Add<HConstant>(AllocationMemento::kSize));
2032  size->ClearFlag(HValue::kCanOverflow);
2033  }
2034 
2035  // Perform the actual allocation.
2036  HAllocate* object = Add<HAllocate>(
2037  size, type, allocation_mode.GetPretenureMode(),
2038  instance_type, allocation_mode.feedback_site());
2039 
2040  // Setup the allocation memento.
2041  if (allocation_mode.CreateAllocationMementos()) {
2043  object, object_size, allocation_mode.current_site());
2044  }
2045 
2046  return object;
2047 }
void BuildCreateAllocationMemento(HValue *previous_object, HValue *previous_object_size, HValue *payload)
Definition: hydrogen.cc:3075
enable harmony numeric enable harmony object literal extensions Optimize object size

References size.

◆ BuildAllocateArrayFromLength()

HValue * v8::internal::HGraphBuilder::BuildAllocateArrayFromLength ( JSArrayBuilder *  array_builder,
HValue length_argument 
)
protected

Definition at line 2514 of file hydrogen.cc.

2516  {
2517  if (length_argument->IsConstant() &&
2518  HConstant::cast(length_argument)->HasSmiValue()) {
2519  int array_length = HConstant::cast(length_argument)->Integer32Value();
2520  if (array_length == 0) {
2521  return array_builder->AllocateEmptyArray();
2522  } else {
2523  return array_builder->AllocateArray(length_argument,
2524  array_length,
2525  length_argument);
2526  }
2527  }
2528 
2529  HValue* constant_zero = graph()->GetConstant0();
2530  HConstant* max_alloc_length =
2531  Add<HConstant>(JSObject::kInitialMaxFastElementArray);
2532  HInstruction* checked_length = Add<HBoundsCheck>(length_argument,
2533  max_alloc_length);
2534  IfBuilder if_builder(this);
2535  if_builder.If<HCompareNumericAndBranch>(checked_length, constant_zero,
2536  Token::EQ);
2537  if_builder.Then();
2538  const int initial_capacity = JSArray::kPreallocatedArrayElements;
2539  HConstant* initial_capacity_node = Add<HConstant>(initial_capacity);
2540  Push(initial_capacity_node); // capacity
2541  Push(constant_zero); // length
2542  if_builder.Else();
2543  if (!(top_info()->IsStub()) &&
2544  IsFastPackedElementsKind(array_builder->kind())) {
2545  // We'll come back later with better (holey) feedback.
2546  if_builder.Deopt("Holey array despite packed elements_kind feedback");
2547  } else {
2548  Push(checked_length); // capacity
2549  Push(checked_length); // length
2550  }
2551  if_builder.End();
2552 
2553  // Figure out total size
2554  HValue* length = Pop();
2555  HValue* capacity = Pop();
2556  return array_builder->AllocateArray(capacity, max_alloc_length, length);
2557 }
void Push(HValue *value)
Definition: hydrogen.h:1070
CompilationInfo * top_info()
Definition: hydrogen.h:1065
static const int kPreallocatedArrayElements
Definition: objects.h:10069
static const int kInitialMaxFastElementArray
Definition: objects.h:2180
bool IsFastPackedElementsKind(ElementsKind kind)

References v8::internal::EQ, v8::internal::IsFastPackedElementsKind(), and v8::internal::compiler::Push().

Referenced by v8::internal::CodeStubGraphBuilderBase::BuildArraySingleArgumentConstructor(), and v8::internal::HOptimizedGraphBuilder::BuildInlinedCallArray().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildAllocateElements()

HAllocate * v8::internal::HGraphBuilder::BuildAllocateElements ( ElementsKind  kind,
HValue size_in_bytes 
)
protected

Definition at line 2604 of file hydrogen.cc.

2605  {
2606  InstanceType instance_type = IsFastDoubleElementsKind(kind)
2608  : FIXED_ARRAY_TYPE;
2609 
2610  return Add<HAllocate>(size_in_bytes, HType::HeapObject(), NOT_TENURED,
2611  instance_type);
2612 }
@ FIXED_DOUBLE_ARRAY_TYPE
Definition: objects.h:692
@ FIXED_ARRAY_TYPE
Definition: objects.h:717
bool IsFastDoubleElementsKind(ElementsKind kind)

References v8::internal::FIXED_ARRAY_TYPE, v8::internal::FIXED_DOUBLE_ARRAY_TYPE, v8::internal::IsFastDoubleElementsKind(), and v8::internal::NOT_TENURED.

+ Here is the call graph for this function:

◆ BuildAllocateElementsAndInitializeElementsHeader()

HValue * v8::internal::HGraphBuilder::BuildAllocateElementsAndInitializeElementsHeader ( ElementsKind  kind,
HValue capacity 
)
protected

Definition at line 2629 of file hydrogen.cc.

2631  {
2632  // The HForceRepresentation is to prevent possible deopt on int-smi
2633  // conversion after allocation but before the new object fields are set.
2634  capacity = AddUncasted<HForceRepresentation>(capacity, Representation::Smi());
2635  HValue* size_in_bytes = BuildCalculateElementsSize(kind, capacity);
2636  HValue* new_elements = BuildAllocateElements(kind, size_in_bytes);
2637  BuildInitializeElementsHeader(new_elements, kind, capacity);
2638  return new_elements;
2639 }
HAllocate * BuildAllocateElements(ElementsKind kind, HValue *size_in_bytes)
Definition: hydrogen.cc:2604
HValue * BuildCalculateElementsSize(ElementsKind kind, HValue *capacity)
Definition: hydrogen.cc:2560
void BuildInitializeElementsHeader(HValue *elements, ElementsKind kind, HValue *capacity)
Definition: hydrogen.cc:2615
static Representation Smi()

◆ BuildArrayBufferViewInitialization()

template<class ViewClass >
void v8::internal::HGraphBuilder::BuildArrayBufferViewInitialization ( HValue obj,
HValue buffer,
HValue byte_offset,
HValue byte_length 
)
protected

Definition at line 9398 of file hydrogen.cc.

9402  {
9403 
9404  for (int offset = ViewClass::kSize;
9405  offset < ViewClass::kSizeWithInternalFields;
9406  offset += kPointerSize) {
9407  Add<HStoreNamedField>(obj,
9408  HObjectAccess::ForObservableJSObjectOffset(offset),
9409  graph()->GetConstant0());
9410  }
9411 
9412  Add<HStoreNamedField>(
9413  obj,
9414  HObjectAccess::ForJSArrayBufferViewByteOffset(),
9415  byte_offset);
9416  Add<HStoreNamedField>(
9417  obj,
9418  HObjectAccess::ForJSArrayBufferViewByteLength(),
9419  byte_length);
9420 
9421  if (buffer != NULL) {
9422  Add<HStoreNamedField>(
9423  obj,
9424  HObjectAccess::ForJSArrayBufferViewBuffer(), buffer);
9425  HObjectAccess weak_first_view_access =
9426  HObjectAccess::ForJSArrayBufferWeakFirstView();
9427  Add<HStoreNamedField>(obj,
9428  HObjectAccess::ForJSArrayBufferViewWeakNext(),
9429  Add<HLoadNamedField>(buffer,
9430  static_cast<HValue*>(NULL),
9431  weak_first_view_access));
9432  Add<HStoreNamedField>(buffer, weak_first_view_access, obj);
9433  } else {
9434  Add<HStoreNamedField>(
9435  obj,
9436  HObjectAccess::ForJSArrayBufferViewBuffer(),
9437  Add<HConstant>(static_cast<int32_t>(0)));
9438  Add<HStoreNamedField>(obj,
9439  HObjectAccess::ForJSArrayBufferViewWeakNext(),
9440  graph()->GetConstantUndefined());
9441  }
9442 }
int int32_t
Definition: unicode.cc:24
const int kPointerSize
Definition: globals.h:129

References graph(), v8::internal::kPointerSize, and NULL.

+ Here is the call graph for this function:

◆ BuildBinaryOperation()

HValue * v8::internal::HGraphBuilder::BuildBinaryOperation ( Token::Value  op,
HValue left,
HValue right,
Type left_type,
Type right_type,
Type result_type,
Maybe< int fixed_right_arg,
HAllocationMode  allocation_mode 
)
protected

Definition at line 10259 of file hydrogen.cc.

10267  {
10268 
10269  Representation left_rep = Representation::FromType(left_type);
10270  Representation right_rep = Representation::FromType(right_type);
10271 
10272  bool maybe_string_add = op == Token::ADD &&
10273  (left_type->Maybe(Type::String()) ||
10274  left_type->Maybe(Type::Receiver()) ||
10275  right_type->Maybe(Type::String()) ||
10276  right_type->Maybe(Type::Receiver()));
10277 
10278  if (!left_type->IsInhabited()) {
10279  Add<HDeoptimize>("Insufficient type feedback for LHS of binary operation",
10281  // TODO(rossberg): we should be able to get rid of non-continuous
10282  // defaults.
10283  left_type = Type::Any(zone());
10284  } else {
10285  if (!maybe_string_add) left = TruncateToNumber(left, &left_type);
10286  left_rep = Representation::FromType(left_type);
10287  }
10288 
10289  if (!right_type->IsInhabited()) {
10290  Add<HDeoptimize>("Insufficient type feedback for RHS of binary operation",
10292  right_type = Type::Any(zone());
10293  } else {
10294  if (!maybe_string_add) right = TruncateToNumber(right, &right_type);
10295  right_rep = Representation::FromType(right_type);
10296  }
10297 
10298  // Special case for string addition here.
10299  if (op == Token::ADD &&
10300  (left_type->Is(Type::String()) || right_type->Is(Type::String()))) {
10301  // Validate type feedback for left argument.
10302  if (left_type->Is(Type::String())) {
10303  left = BuildCheckString(left);
10304  }
10305 
10306  // Validate type feedback for right argument.
10307  if (right_type->Is(Type::String())) {
10308  right = BuildCheckString(right);
10309  }
10310 
10311  // Convert left argument as necessary.
10312  if (left_type->Is(Type::Number())) {
10313  DCHECK(right_type->Is(Type::String()));
10314  left = BuildNumberToString(left, left_type);
10315  } else if (!left_type->Is(Type::String())) {
10316  DCHECK(right_type->Is(Type::String()));
10317  HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_RIGHT);
10318  Add<HPushArguments>(left, right);
10319  return AddUncasted<HInvokeFunction>(function, 2);
10320  }
10321 
10322  // Convert right argument as necessary.
10323  if (right_type->Is(Type::Number())) {
10324  DCHECK(left_type->Is(Type::String()));
10325  right = BuildNumberToString(right, right_type);
10326  } else if (!right_type->Is(Type::String())) {
10327  DCHECK(left_type->Is(Type::String()));
10328  HValue* function = AddLoadJSBuiltin(Builtins::STRING_ADD_LEFT);
10329  Add<HPushArguments>(left, right);
10330  return AddUncasted<HInvokeFunction>(function, 2);
10331  }
10332 
10333  // Fast path for empty constant strings.
10334  if (left->IsConstant() &&
10335  HConstant::cast(left)->HasStringValue() &&
10336  HConstant::cast(left)->StringValue()->length() == 0) {
10337  return right;
10338  }
10339  if (right->IsConstant() &&
10340  HConstant::cast(right)->HasStringValue() &&
10341  HConstant::cast(right)->StringValue()->length() == 0) {
10342  return left;
10343  }
10344 
10345  // Register the dependent code with the allocation site.
10346  if (!allocation_mode.feedback_site().is_null()) {
10347  DCHECK(!graph()->info()->IsStub());
10348  Handle<AllocationSite> site(allocation_mode.feedback_site());
10351  }
10352 
10353  // Inline the string addition into the stub when creating allocation
10354  // mementos to gather allocation site feedback, or if we can statically
10355  // infer that we're going to create a cons string.
10356  if ((graph()->info()->IsStub() &&
10357  allocation_mode.CreateAllocationMementos()) ||
10358  (left->IsConstant() &&
10359  HConstant::cast(left)->HasStringValue() &&
10360  HConstant::cast(left)->StringValue()->length() + 1 >=
10362  (right->IsConstant() &&
10363  HConstant::cast(right)->HasStringValue() &&
10364  HConstant::cast(right)->StringValue()->length() + 1 >=
10366  return BuildStringAdd(left, right, allocation_mode);
10367  }
10368 
10369  // Fallback to using the string add stub.
10370  return AddUncasted<HStringAdd>(
10371  left, right, allocation_mode.GetPretenureMode(),
10372  STRING_ADD_CHECK_NONE, allocation_mode.feedback_site());
10373  }
10374 
10375  if (graph()->info()->IsStub()) {
10376  left = EnforceNumberType(left, left_type);
10377  right = EnforceNumberType(right, right_type);
10378  }
10379 
10380  Representation result_rep = Representation::FromType(result_type);
10381 
10382  bool is_non_primitive = (left_rep.IsTagged() && !left_rep.IsSmi()) ||
10383  (right_rep.IsTagged() && !right_rep.IsSmi());
10384 
10385  HInstruction* instr = NULL;
10386  // Only the stub is allowed to call into the runtime, since otherwise we would
10387  // inline several instructions (including the two pushes) for every tagged
10388  // operation in optimized code, which is more expensive, than a stub call.
10389  if (graph()->info()->IsStub() && is_non_primitive) {
10390  HValue* function = AddLoadJSBuiltin(BinaryOpIC::TokenToJSBuiltin(op));
10391  Add<HPushArguments>(left, right);
10392  instr = AddUncasted<HInvokeFunction>(function, 2);
10393  } else {
10394  switch (op) {
10395  case Token::ADD:
10396  instr = AddUncasted<HAdd>(left, right);
10397  break;
10398  case Token::SUB:
10399  instr = AddUncasted<HSub>(left, right);
10400  break;
10401  case Token::MUL:
10402  instr = AddUncasted<HMul>(left, right);
10403  break;
10404  case Token::MOD: {
10405  if (fixed_right_arg.has_value &&
10406  !right->EqualsInteger32Constant(fixed_right_arg.value)) {
10407  HConstant* fixed_right = Add<HConstant>(
10408  static_cast<int>(fixed_right_arg.value));
10409  IfBuilder if_same(this);
10410  if_same.If<HCompareNumericAndBranch>(right, fixed_right, Token::EQ);
10411  if_same.Then();
10412  if_same.ElseDeopt("Unexpected RHS of binary operation");
10413  right = fixed_right;
10414  }
10415  instr = AddUncasted<HMod>(left, right);
10416  break;
10417  }
10418  case Token::DIV:
10419  instr = AddUncasted<HDiv>(left, right);
10420  break;
10421  case Token::BIT_XOR:
10422  case Token::BIT_AND:
10423  instr = AddUncasted<HBitwise>(op, left, right);
10424  break;
10425  case Token::BIT_OR: {
10426  HValue* operand, *shift_amount;
10427  if (left_type->Is(Type::Signed32()) &&
10428  right_type->Is(Type::Signed32()) &&
10429  MatchRotateRight(left, right, &operand, &shift_amount)) {
10430  instr = AddUncasted<HRor>(operand, shift_amount);
10431  } else {
10432  instr = AddUncasted<HBitwise>(op, left, right);
10433  }
10434  break;
10435  }
10436  case Token::SAR:
10437  instr = AddUncasted<HSar>(left, right);
10438  break;
10439  case Token::SHR:
10440  instr = AddUncasted<HShr>(left, right);
10441  if (FLAG_opt_safe_uint32_operations && instr->IsShr() &&
10442  CanBeZero(right)) {
10443  graph()->RecordUint32Instruction(instr);
10444  }
10445  break;
10446  case Token::SHL:
10447  instr = AddUncasted<HShl>(left, right);
10448  break;
10449  default:
10450  UNREACHABLE();
10451  }
10452  }
10453 
10454  if (instr->IsBinaryOperation()) {
10455  HBinaryOperation* binop = HBinaryOperation::cast(instr);
10456  binop->set_observed_input_representation(1, left_rep);
10457  binop->set_observed_input_representation(2, right_rep);
10458  binop->initialize_output_representation(result_rep);
10459  if (graph()->info()->IsStub()) {
10460  // Stub should not call into stub.
10461  instr->SetFlag(HValue::kCannotBeTagged);
10462  // And should truncate on HForceRepresentation already.
10463  if (left->IsForceRepresentation()) {
10464  left->CopyFlag(HValue::kTruncatingToSmi, instr);
10465  left->CopyFlag(HValue::kTruncatingToInt32, instr);
10466  }
10467  if (right->IsForceRepresentation()) {
10468  right->CopyFlag(HValue::kTruncatingToSmi, instr);
10469  right->CopyFlag(HValue::kTruncatingToInt32, instr);
10470  }
10471  }
10472  }
10473  return instr;
10474 }
static void AddDependentCompilationInfo(Handle< AllocationSite > site, Reason reason, CompilationInfo *info)
Definition: objects.cc:12660
static Builtins::JavaScript TokenToJSBuiltin(Token::Value op)
Definition: ic.cc:2454
static const int kMinLength
Definition: objects.h:9066
HValue * BuildStringAdd(HValue *left, HValue *right, HAllocationMode allocation_mode)
Definition: hydrogen.cc:2349
HValue * AddLoadJSBuiltin(Builtins::JavaScript builtin)
Definition: hydrogen.cc:3306
HValue * BuildNumberToString(HValue *object, Type *type)
Definition: hydrogen.cc:1878
HValue * EnforceNumberType(HValue *number, Type *expected)
Definition: hydrogen.cc:10171
HValue * TruncateToNumber(HValue *value, Type **expected)
Definition: hydrogen.cc:10184
HValue * BuildCheckString(HValue *string)
Definition: hydrogen.cc:1278
bool MatchRotateRight(HValue *left, HValue *right, HValue **operand, HValue **shift_amount)
Definition: hydrogen.cc:10132
static HValue * cast(HValue *value)
static Representation FromType(Type *type)
#define UNREACHABLE()
Definition: logging.h:30
@ STRING_ADD_CHECK_NONE
Definition: code-stubs.h:1212
bool CanBeZero(HValue *right)
Definition: hydrogen.cc:10159
T value
Definition: v8.h:896
bool has_value
Definition: v8.h:895

References v8::internal::ADD, v8::internal::AllocationSite::AddDependentCompilationInfo(), AddLoadJSBuiltin(), BuildCheckString(), BuildNumberToString(), BuildStringAdd(), v8::internal::CanBeZero(), v8::internal::HValue::cast(), v8::internal::HValue::CopyFlag(), DCHECK, v8::internal::DIV, EnforceNumberType(), v8::internal::EQ, v8::internal::HValue::EqualsInteger32Constant(), v8::internal::Representation::FromType(), graph(), v8::Maybe< T >::has_value, v8::internal::HBinaryOperation::initialize_output_representation(), v8::internal::TypeImpl< Config >::Is(), v8::internal::TypeImpl< Config >::IsInhabited(), v8::internal::Representation::IsSmi(), v8::internal::Representation::IsTagged(), v8::internal::HValue::kCannotBeTagged, v8::internal::ConsString::kMinLength, v8::internal::HValue::kTruncatingToInt32, v8::internal::HValue::kTruncatingToSmi, MatchRotateRight(), v8::internal::TypeImpl< Config >::Maybe(), v8::internal::MUL, NULL, v8::internal::HBinaryOperation::set_observed_input_representation(), v8::internal::HValue::SetFlag(), v8::internal::Deoptimizer::SOFT, v8::internal::STRING_ADD_CHECK_NONE, v8::internal::SUB, v8::internal::AllocationSite::TENURING, v8::internal::BinaryOpIC::TokenToJSBuiltin(), top_info(), TruncateToNumber(), UNREACHABLE, v8::Maybe< T >::value, and zone().

Referenced by v8::internal::HOptimizedGraphBuilder::BuildBinaryOperation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildCalculateElementsSize()

HValue * v8::internal::HGraphBuilder::BuildCalculateElementsSize ( ElementsKind  kind,
HValue capacity 
)
protected

Definition at line 2560 of file hydrogen.cc.

2561  {
2562  int elements_size = IsFastDoubleElementsKind(kind)
2563  ? kDoubleSize
2564  : kPointerSize;
2565 
2566  HConstant* elements_size_value = Add<HConstant>(elements_size);
2567  HInstruction* mul = HMul::NewImul(zone(), context(),
2568  capacity->ActualValue(),
2569  elements_size_value);
2570  AddInstruction(mul);
2571  mul->ClearFlag(HValue::kCanOverflow);
2572 
2574 
2575  HConstant* header_size = Add<HConstant>(FixedArray::kHeaderSize);
2576  HValue* total_size = AddUncasted<HAdd>(mul, header_size);
2577  total_size->ClearFlag(HValue::kCanOverflow);
2578  return total_size;
2579 }
static const int kHeaderSize
Definition: objects.h:2393
const int kDoubleSize
Definition: globals.h:127
STATIC_ASSERT(sizeof(CPURegister)==sizeof(Register))

References v8::internal::HValue::ActualValue(), v8::internal::HValue::ClearFlag(), v8::internal::IsFastDoubleElementsKind(), v8::internal::kDoubleSize, v8::internal::kPointerSize, and STATIC_ASSERT.

+ Here is the call graph for this function:

◆ BuildCheckForCapacityGrow()

HValue * v8::internal::HGraphBuilder::BuildCheckForCapacityGrow ( HValue object,
HValue elements,
ElementsKind  kind,
HValue length,
HValue key,
bool  is_js_array,
PropertyAccessType  access_type 
)
protected

Definition at line 1302 of file hydrogen.cc.

1309  {
1310  IfBuilder length_checker(this);
1311 
1312  Token::Value token = IsHoleyElementsKind(kind) ? Token::GTE : Token::EQ;
1313  length_checker.If<HCompareNumericAndBranch>(key, length, token);
1314 
1315  length_checker.Then();
1316 
1317  HValue* current_capacity = AddLoadFixedArrayLength(elements);
1318 
1319  IfBuilder capacity_checker(this);
1320 
1321  capacity_checker.If<HCompareNumericAndBranch>(key, current_capacity,
1322  Token::GTE);
1323  capacity_checker.Then();
1324 
1325  HValue* max_gap = Add<HConstant>(static_cast<int32_t>(JSObject::kMaxGap));
1326  HValue* max_capacity = AddUncasted<HAdd>(current_capacity, max_gap);
1327 
1328  Add<HBoundsCheck>(key, max_capacity);
1329 
1330  HValue* new_capacity = BuildNewElementsCapacity(key);
1331  HValue* new_elements = BuildGrowElementsCapacity(object, elements,
1332  kind, kind, length,
1333  new_capacity);
1334 
1335  environment()->Push(new_elements);
1336  capacity_checker.Else();
1337 
1338  environment()->Push(elements);
1339  capacity_checker.End();
1340 
1341  if (is_js_array) {
1342  HValue* new_length = AddUncasted<HAdd>(key, graph_->GetConstant1());
1343  new_length->ClearFlag(HValue::kCanOverflow);
1344 
1345  Add<HStoreNamedField>(object, HObjectAccess::ForArrayLength(kind),
1346  new_length);
1347  }
1348 
1349  if (access_type == STORE && kind == FAST_SMI_ELEMENTS) {
1350  HValue* checked_elements = environment()->Top();
1351 
1352  // Write zero to ensure that the new element is initialized with some smi.
1353  Add<HStoreKeyed>(checked_elements, key, graph()->GetConstant0(), kind);
1354  }
1355 
1356  length_checker.Else();
1357  Add<HBoundsCheck>(key, length);
1358 
1359  environment()->Push(elements);
1360  length_checker.End();
1361 
1362  return environment()->Pop();
1363 }
HEnvironment * environment() const
Definition: hydrogen.h:1059
HLoadNamedField * AddLoadFixedArrayLength(HValue *object, HValue *dependency=NULL)
Definition: hydrogen.cc:2715
HValue * BuildNewElementsCapacity(HValue *old_capacity)
Definition: hydrogen.cc:2731
HValue * BuildGrowElementsCapacity(HValue *object, HValue *elements, ElementsKind kind, ElementsKind new_kind, HValue *length, HValue *new_capacity)
Definition: hydrogen.cc:2747
static const uint32_t kMaxGap
Definition: objects.h:2168
bool IsHoleyElementsKind(ElementsKind kind)

References v8::internal::HValue::ClearFlag(), v8::internal::EQ, v8::internal::FAST_SMI_ELEMENTS, v8::internal::IsHoleyElementsKind(), and STORE.

+ Here is the call graph for this function:

◆ BuildCheckHeapObject()

HValue * v8::internal::HGraphBuilder::BuildCheckHeapObject ( HValue object)
protected

Definition at line 1266 of file hydrogen.cc.

1266  {
1267  if (obj->type().IsHeapObject()) return obj;
1268  return Add<HCheckHeapObject>(obj);
1269 }

References v8::internal::HValue::type().

Referenced by v8::internal::HOptimizedGraphBuilder::AddCheckMap(), v8::internal::HOptimizedGraphBuilder::BuildCompareInstruction(), v8::internal::HOptimizedGraphBuilder::BuildNamedAccess(), v8::internal::CodeStubGraphBuilderBase::BuildStoreNamedField(), v8::internal::HOptimizedGraphBuilder::BuildStoreNamedField(), v8::internal::HOptimizedGraphBuilder::HandleKeyedElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), and v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildCheckPrototypeMaps()

HInstruction * v8::internal::HGraphBuilder::BuildCheckPrototypeMaps ( Handle< JSObject prototype,
Handle< JSObject holder 
)
protected

Definition at line 7403 of file hydrogen.cc.

7404  {
7405  PrototypeIterator iter(isolate(), prototype,
7407  while (holder.is_null() ||
7408  !PrototypeIterator::GetCurrent(iter).is_identical_to(holder)) {
7411  iter.Advance();
7412  if (iter.IsAtEnd()) {
7413  return NULL;
7414  }
7415  }
7416  return BuildConstantMapCheck(
7418 }
HInstruction * BuildConstantMapCheck(Handle< JSObject > constant)
Definition: hydrogen.cc:7395
static Handle< T > cast(Handle< S > that)
Definition: handles.h:116
Object * GetCurrent() const
Definition: prototype.h:62

References v8::internal::PrototypeIterator::Advance(), BuildConstantMapCheck(), v8::internal::PrototypeIterator::GetCurrent(), v8::internal::Handle< T >::is_null(), v8::internal::PrototypeIterator::IsAtEnd(), isolate(), NULL, and v8::internal::PrototypeIterator::START_AT_RECEIVER.

Referenced by v8::internal::HOptimizedGraphBuilder::AddCheckPrototypeMaps(), v8::internal::HOptimizedGraphBuilder::BuildKeyedHoleMode(), v8::internal::HOptimizedGraphBuilder::BuildMonomorphicAccess(), v8::internal::HOptimizedGraphBuilder::BuildMonomorphicElementAccess(), and v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildCheckString()

HValue * v8::internal::HGraphBuilder::BuildCheckString ( HValue string)
protected

Definition at line 1278 of file hydrogen.cc.

1278  {
1279  if (!string->type().IsString()) {
1280  DCHECK(!string->IsConstant() ||
1281  !HConstant::cast(string)->HasStringValue());
1282  BuildCheckHeapObject(string);
1283  return Add<HCheckInstanceType>(string, HCheckInstanceType::IS_STRING);
1284  }
1285  return string;
1286 }
HValue * BuildCheckHeapObject(HValue *object)
Definition: hydrogen.cc:1266

References DCHECK, and v8::internal::HValue::type().

Referenced by BuildBinaryOperation(), and v8::internal::HOptimizedGraphBuilder::BuildStringCharCodeAt().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildCloneShallowArrayCow()

HValue * v8::internal::HGraphBuilder::BuildCloneShallowArrayCow ( HValue boilerplate,
HValue allocation_site,
AllocationSiteMode  mode,
ElementsKind  kind 
)
protected

Definition at line 2929 of file hydrogen.cc.

2932  {
2933  HAllocate* array = AllocateJSArrayObject(mode);
2934 
2935  HValue* map = AddLoadMap(boilerplate);
2936  HValue* elements = AddLoadElements(boilerplate);
2937  HValue* length = AddLoadArrayLength(boilerplate, kind);
2938 
2939  BuildJSArrayHeader(array,
2940  map,
2941  elements,
2942  mode,
2943  FAST_ELEMENTS,
2944  allocation_site,
2945  length);
2946  return array;
2947 }
void BuildJSArrayHeader(HValue *array, HValue *array_map, HValue *elements, AllocationSiteMode mode, ElementsKind elements_kind, HValue *allocation_site_payload, HValue *length_field)
Definition: hydrogen.cc:2642
HLoadNamedField * AddLoadElements(HValue *object, HValue *dependency=NULL)
Definition: hydrogen.cc:2708
HLoadNamedField * AddLoadMap(HValue *object, HValue *dependency=NULL)
Definition: hydrogen.cc:2702
HLoadNamedField * AddLoadArrayLength(HValue *object, ElementsKind kind, HValue *dependency=NULL)
Definition: hydrogen.cc:2723
HAllocate * AllocateJSArrayObject(AllocationSiteMode mode)
Definition: hydrogen.cc:2582

References v8::internal::FAST_ELEMENTS, map, and mode().

+ Here is the call graph for this function:

◆ BuildCloneShallowArrayEmpty()

HValue * v8::internal::HGraphBuilder::BuildCloneShallowArrayEmpty ( HValue boilerplate,
HValue allocation_site,
AllocationSiteMode  mode 
)
protected

Definition at line 2950 of file hydrogen.cc.

2952  {
2953  HAllocate* array = AllocateJSArrayObject(mode);
2954 
2955  HValue* map = AddLoadMap(boilerplate);
2956 
2957  BuildJSArrayHeader(array,
2958  map,
2959  NULL, // set elements to empty fixed array
2960  mode,
2961  FAST_ELEMENTS,
2962  allocation_site,
2963  graph()->GetConstant0());
2964  return array;
2965 }

References v8::internal::FAST_ELEMENTS, map, mode(), and NULL.

+ Here is the call graph for this function:

◆ BuildCloneShallowArrayNonEmpty()

HValue * v8::internal::HGraphBuilder::BuildCloneShallowArrayNonEmpty ( HValue boilerplate,
HValue allocation_site,
AllocationSiteMode  mode,
ElementsKind  kind 
)
protected

Definition at line 2968 of file hydrogen.cc.

2971  {
2972  HValue* boilerplate_elements = AddLoadElements(boilerplate);
2973  HValue* capacity = AddLoadFixedArrayLength(boilerplate_elements);
2974 
2975  // Generate size calculation code here in order to make it dominate
2976  // the JSArray allocation.
2977  HValue* elements_size = BuildCalculateElementsSize(kind, capacity);
2978 
2979  // Create empty JSArray object for now, store elimination should remove
2980  // redundant initialization of elements and length fields and at the same
2981  // time the object will be fully prepared for GC if it happens during
2982  // elements allocation.
2983  HValue* result = BuildCloneShallowArrayEmpty(
2984  boilerplate, allocation_site, mode);
2985 
2986  HAllocate* elements = BuildAllocateElements(kind, elements_size);
2987 
2988  // This function implicitly relies on the fact that the
2989  // FastCloneShallowArrayStub is called only for literals shorter than
2990  // JSObject::kInitialMaxFastElementArray.
2991  // Can't add HBoundsCheck here because otherwise the stub will eager a frame.
2992  HConstant* size_upper_bound = EstablishElementsAllocationSize(
2994  elements->set_size_upper_bound(size_upper_bound);
2995 
2996  Add<HStoreNamedField>(result, HObjectAccess::ForElementsPointer(), elements);
2997 
2998  // The allocation for the cloned array above causes register pressure on
2999  // machines with low register counts. Force a reload of the boilerplate
3000  // elements here to free up a register for the allocation to avoid unnecessary
3001  // spillage.
3002  boilerplate_elements = AddLoadElements(boilerplate);
3003  boilerplate_elements->SetFlag(HValue::kCantBeReplaced);
3004 
3005  // Copy the elements array header.
3006  for (int i = 0; i < FixedArrayBase::kHeaderSize; i += kPointerSize) {
3007  HObjectAccess access = HObjectAccess::ForFixedArrayHeader(i);
3008  Add<HStoreNamedField>(elements, access,
3009  Add<HLoadNamedField>(boilerplate_elements,
3010  static_cast<HValue*>(NULL), access));
3011  }
3012 
3013  // And the result of the length
3014  HValue* length = AddLoadArrayLength(boilerplate, kind);
3015  Add<HStoreNamedField>(result, HObjectAccess::ForArrayLength(kind), length);
3016 
3017  BuildCopyElements(boilerplate_elements, kind, elements,
3018  kind, length, NULL);
3019  return result;
3020 }
void BuildCopyElements(HValue *from_elements, ElementsKind from_elements_kind, HValue *to_elements, ElementsKind to_elements_kind, HValue *length, HValue *capacity)
Definition: hydrogen.cc:2839
HConstant * EstablishElementsAllocationSize(ElementsKind kind, int capacity)
Definition: hydrogen.cc:2593
HValue * BuildCloneShallowArrayEmpty(HValue *boilerplate, HValue *allocation_site, AllocationSiteMode mode)
Definition: hydrogen.cc:2950

References v8::internal::kPointerSize, mode(), NULL, and v8::internal::HValue::SetFlag().

+ Here is the call graph for this function:

◆ BuildCompareNil()

void v8::internal::HGraphBuilder::BuildCompareNil ( HValue value,
Type type,
HIfContinuation *  continuation 
)
protected

Definition at line 3023 of file hydrogen.cc.

3026  {
3027  IfBuilder if_nil(this);
3028  bool some_case_handled = false;
3029  bool some_case_missing = false;
3030 
3031  if (type->Maybe(Type::Null())) {
3032  if (some_case_handled) if_nil.Or();
3033  if_nil.If<HCompareObjectEqAndBranch>(value, graph()->GetConstantNull());
3034  some_case_handled = true;
3035  } else {
3036  some_case_missing = true;
3037  }
3038 
3039  if (type->Maybe(Type::Undefined())) {
3040  if (some_case_handled) if_nil.Or();
3041  if_nil.If<HCompareObjectEqAndBranch>(value,
3042  graph()->GetConstantUndefined());
3043  some_case_handled = true;
3044  } else {
3045  some_case_missing = true;
3046  }
3047 
3048  if (type->Maybe(Type::Undetectable())) {
3049  if (some_case_handled) if_nil.Or();
3050  if_nil.If<HIsUndetectableAndBranch>(value);
3051  some_case_handled = true;
3052  } else {
3053  some_case_missing = true;
3054  }
3055 
3056  if (some_case_missing) {
3057  if_nil.Then();
3058  if_nil.Else();
3059  if (type->NumClasses() == 1) {
3060  BuildCheckHeapObject(value);
3061  // For ICs, the map checked below is a sentinel map that gets replaced by
3062  // the monomorphic map when the code is used as a template to generate a
3063  // new IC. For optimized functions, there is no sentinel map, the map
3064  // emitted below is the actual monomorphic map.
3065  Add<HCheckMaps>(value, type->Classes().Current());
3066  } else {
3067  if_nil.Deopt("Too many undetectable types");
3068  }
3069  }
3070 
3071  if_nil.CaptureContinuation(continuation);
3072 }
Handle< Primitive > Null(Isolate *isolate)
Definition: v8.h:6845
Handle< Primitive > Undefined(Isolate *isolate)
Definition: v8.h:6836

References v8::internal::TypeImpl< Config >::Classes(), v8::internal::TypeImpl< Config >::Maybe(), v8::Null(), v8::internal::TypeImpl< Config >::NumClasses(), and v8::Undefined().

Referenced by v8::internal::HOptimizedGraphBuilder::HandleLiteralCompareNil().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildConstantMapCheck()

HInstruction * v8::internal::HGraphBuilder::BuildConstantMapCheck ( Handle< JSObject constant)
protected

Definition at line 7395 of file hydrogen.cc.

7395  {
7396  HCheckMaps* check = Add<HCheckMaps>(
7397  Add<HConstant>(constant), handle(constant->map()));
7398  check->ClearDependsOnFlag(kElementsKind);
7399  return check;
7400 }
Handle< T > handle(T *t, Isolate *isolate)
Definition: handles.h:146

References v8::internal::handle().

Referenced by BuildCheckPrototypeMaps().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildCopyElements()

void v8::internal::HGraphBuilder::BuildCopyElements ( HValue from_elements,
ElementsKind  from_elements_kind,
HValue to_elements,
ElementsKind  to_elements_kind,
HValue length,
HValue capacity 
)
protected

Definition at line 2839 of file hydrogen.cc.

2844  {
2845  int constant_capacity = -1;
2846  if (capacity != NULL &&
2847  capacity->IsConstant() &&
2848  HConstant::cast(capacity)->HasInteger32Value()) {
2849  int constant_candidate = HConstant::cast(capacity)->Integer32Value();
2850  if (constant_candidate <= kElementLoopUnrollThreshold) {
2851  constant_capacity = constant_candidate;
2852  }
2853  }
2854 
2855  bool pre_fill_with_holes =
2856  IsFastDoubleElementsKind(from_elements_kind) &&
2857  IsFastObjectElementsKind(to_elements_kind);
2858  if (pre_fill_with_holes) {
2859  // If the copy might trigger a GC, make sure that the FixedArray is
2860  // pre-initialized with holes to make sure that it's always in a
2861  // consistent state.
2862  BuildFillElementsWithHole(to_elements, to_elements_kind,
2863  graph()->GetConstant0(), NULL);
2864  }
2865 
2866  if (constant_capacity != -1) {
2867  // Unroll the loop for small elements kinds.
2868  for (int i = 0; i < constant_capacity; i++) {
2869  HValue* key_constant = Add<HConstant>(i);
2870  HInstruction* value = Add<HLoadKeyed>(from_elements, key_constant,
2871  static_cast<HValue*>(NULL),
2872  from_elements_kind);
2873  Add<HStoreKeyed>(to_elements, key_constant, value, to_elements_kind);
2874  }
2875  } else {
2876  if (!pre_fill_with_holes &&
2877  (capacity == NULL || !length->Equals(capacity))) {
2878  BuildFillElementsWithHole(to_elements, to_elements_kind,
2879  length, NULL);
2880  }
2881 
2882  if (capacity == NULL) {
2883  capacity = AddLoadFixedArrayLength(to_elements);
2884  }
2885 
2886  LoopBuilder builder(this, context(), LoopBuilder::kPostDecrement);
2887 
2888  HValue* key = builder.BeginBody(length, graph()->GetConstant0(),
2889  Token::GT);
2890 
2891  key = AddUncasted<HSub>(key, graph()->GetConstant1());
2892  key->ClearFlag(HValue::kCanOverflow);
2893 
2894  HValue* element = Add<HLoadKeyed>(from_elements, key,
2895  static_cast<HValue*>(NULL),
2896  from_elements_kind,
2898 
2899  ElementsKind kind = (IsHoleyElementsKind(from_elements_kind) &&
2900  IsFastSmiElementsKind(to_elements_kind))
2901  ? FAST_HOLEY_ELEMENTS : to_elements_kind;
2902 
2903  if (IsHoleyElementsKind(from_elements_kind) &&
2904  from_elements_kind != to_elements_kind) {
2905  IfBuilder if_hole(this);
2906  if_hole.If<HCompareHoleAndBranch>(element);
2907  if_hole.Then();
2908  HConstant* hole_constant = IsFastDoubleElementsKind(to_elements_kind)
2909  ? Add<HConstant>(FixedDoubleArray::hole_nan_as_double())
2910  : graph()->GetConstantHole();
2911  Add<HStoreKeyed>(to_elements, key, hole_constant, kind);
2912  if_hole.Else();
2913  HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind);
2914  store->SetFlag(HValue::kAllowUndefinedAsNaN);
2915  if_hole.End();
2916  } else {
2917  HStoreKeyed* store = Add<HStoreKeyed>(to_elements, key, element, kind);
2918  store->SetFlag(HValue::kAllowUndefinedAsNaN);
2919  }
2920 
2921  builder.EndBody();
2922  }
2923 
2924  Counters* counters = isolate()->counters();
2925  AddIncrementCounter(counters->inlined_copied_elements());
2926 }
static double hole_nan_as_double()
Definition: objects-inl.h:2205
static const int kElementLoopUnrollThreshold
Definition: hydrogen.h:1308
void BuildFillElementsWithHole(HValue *elements, ElementsKind elements_kind, HValue *from, HValue *to)
Definition: hydrogen.cc:2822
void AddIncrementCounter(StatsCounter *counter)
Definition: hydrogen.cc:1219
bool IsFastSmiElementsKind(ElementsKind kind)
bool IsFastObjectElementsKind(ElementsKind kind)

References v8::internal::ALLOW_RETURN_HOLE, v8::internal::HValue::ClearFlag(), v8::internal::HValue::Equals(), v8::internal::FAST_HOLEY_ELEMENTS, v8::internal::IsFastDoubleElementsKind(), v8::internal::IsFastObjectElementsKind(), v8::internal::IsFastSmiElementsKind(), v8::internal::IsHoleyElementsKind(), and NULL.

+ Here is the call graph for this function:

◆ BuildCopyElementsOnWrite()

HValue * v8::internal::HGraphBuilder::BuildCopyElementsOnWrite ( HValue object,
HValue elements,
ElementsKind  kind,
HValue length 
)
protected

Definition at line 1366 of file hydrogen.cc.

1369  {
1370  Factory* factory = isolate()->factory();
1371 
1372  IfBuilder cow_checker(this);
1373 
1374  cow_checker.If<HCompareMap>(elements, factory->fixed_cow_array_map());
1375  cow_checker.Then();
1376 
1377  HValue* capacity = AddLoadFixedArrayLength(elements);
1378 
1379  HValue* new_elements = BuildGrowElementsCapacity(object, elements, kind,
1380  kind, length, capacity);
1381 
1382  environment()->Push(new_elements);
1383 
1384  cow_checker.Else();
1385 
1386  environment()->Push(elements);
1387 
1388  cow_checker.End();
1389 
1390  return environment()->Pop();
1391 }
Factory * factory()
Definition: isolate.h:982

Referenced by v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall().

+ Here is the caller graph for this function:

◆ BuildCopySeqStringChars()

void v8::internal::HGraphBuilder::BuildCopySeqStringChars ( HValue src,
HValue src_offset,
String::Encoding  src_encoding,
HValue dst,
HValue dst_offset,
String::Encoding  dst_encoding,
HValue length 
)
protected

Definition at line 2145 of file hydrogen.cc.

2151  {
2152  DCHECK(dst_encoding != String::ONE_BYTE_ENCODING ||
2153  src_encoding == String::ONE_BYTE_ENCODING);
2154  LoopBuilder loop(this, context(), LoopBuilder::kPostIncrement);
2155  HValue* index = loop.BeginBody(graph()->GetConstant0(), length, Token::LT);
2156  {
2157  HValue* src_index = AddUncasted<HAdd>(src_offset, index);
2158  HValue* value =
2159  AddUncasted<HSeqStringGetChar>(src_encoding, src, src_index);
2160  HValue* dst_index = AddUncasted<HAdd>(dst_offset, index);
2161  Add<HSeqStringSetChar>(dst_encoding, dst, dst_index, value);
2162  }
2163  loop.EndBody();
2164 }

References DCHECK.

◆ BuildCreateAllocationMemento()

void v8::internal::HGraphBuilder::BuildCreateAllocationMemento ( HValue previous_object,
HValue previous_object_size,
HValue payload 
)
protected

Definition at line 3075 of file hydrogen.cc.

3078  {
3079  DCHECK(allocation_site != NULL);
3080  HInnerAllocatedObject* allocation_memento = Add<HInnerAllocatedObject>(
3081  previous_object, previous_object_size, HType::HeapObject());
3083  allocation_memento, isolate()->factory()->allocation_memento_map());
3084  Add<HStoreNamedField>(
3085  allocation_memento,
3086  HObjectAccess::ForAllocationMementoSite(),
3087  allocation_site);
3088  if (FLAG_allocation_site_pretenuring) {
3089  HValue* memento_create_count = Add<HLoadNamedField>(
3090  allocation_site, static_cast<HValue*>(NULL),
3091  HObjectAccess::ForAllocationSiteOffset(
3093  memento_create_count = AddUncasted<HAdd>(
3094  memento_create_count, graph()->GetConstant1());
3095  // This smi value is reset to zero after every gc, overflow isn't a problem
3096  // since the counter is bounded by the new space size.
3097  memento_create_count->ClearFlag(HValue::kCanOverflow);
3098  Add<HStoreNamedField>(
3099  allocation_site, HObjectAccess::ForAllocationSiteOffset(
3100  AllocationSite::kPretenureCreateCountOffset), memento_create_count);
3101  }
3102 }
static const int kPretenureCreateCountOffset
Definition: objects.h:8257
HStoreNamedField * AddStoreMapConstant(HValue *object, Handle< Map > map)
Definition: hydrogen.h:1438

References v8::internal::HValue::ClearFlag(), DCHECK, and NULL.

+ Here is the call graph for this function:

◆ BuildCreateConsString()

HValue * v8::internal::HGraphBuilder::BuildCreateConsString ( HValue length,
HValue left,
HValue right,
HAllocationMode  allocation_mode 
)
protected

Definition at line 2061 of file hydrogen.cc.

2065  {
2066  // Determine the string instance types.
2067  HInstruction* left_instance_type = AddLoadStringInstanceType(left);
2068  HInstruction* right_instance_type = AddLoadStringInstanceType(right);
2069 
2070  // Allocate the cons string object. HAllocate does not care whether we
2071  // pass CONS_STRING_TYPE or CONS_ONE_BYTE_STRING_TYPE here, so we just use
2072  // CONS_STRING_TYPE here. Below we decide whether the cons string is
2073  // one-byte or two-byte and set the appropriate map.
2074  DCHECK(HAllocate::CompatibleInstanceTypes(CONS_STRING_TYPE,
2076  HAllocate* result = BuildAllocate(Add<HConstant>(ConsString::kSize),
2077  HType::String(), CONS_STRING_TYPE,
2078  allocation_mode);
2079 
2080  // Compute intersection and difference of instance types.
2081  HValue* anded_instance_types = AddUncasted<HBitwise>(
2082  Token::BIT_AND, left_instance_type, right_instance_type);
2083  HValue* xored_instance_types = AddUncasted<HBitwise>(
2084  Token::BIT_XOR, left_instance_type, right_instance_type);
2085 
2086  // We create a one-byte cons string if
2087  // 1. both strings are one-byte, or
2088  // 2. at least one of the strings is two-byte, but happens to contain only
2089  // one-byte characters.
2090  // To do this, we check
2091  // 1. if both strings are one-byte, or if the one-byte data hint is set in
2092  // both strings, or
2093  // 2. if one of the strings has the one-byte data hint set and the other
2094  // string is one-byte.
2095  IfBuilder if_onebyte(this);
2098  if_onebyte.If<HCompareNumericAndBranch>(
2099  AddUncasted<HBitwise>(
2100  Token::BIT_AND, anded_instance_types,
2101  Add<HConstant>(static_cast<int32_t>(
2103  graph()->GetConstant0(), Token::NE);
2104  if_onebyte.Or();
2106  kOneByteDataHintTag != 0 &&
2108  if_onebyte.If<HCompareNumericAndBranch>(
2109  AddUncasted<HBitwise>(
2110  Token::BIT_AND, xored_instance_types,
2111  Add<HConstant>(static_cast<int32_t>(
2113  Add<HConstant>(static_cast<int32_t>(
2115  if_onebyte.Then();
2116  {
2117  // We can safely skip the write barrier for storing the map here.
2118  Add<HStoreNamedField>(
2119  result, HObjectAccess::ForMap(),
2120  Add<HConstant>(isolate()->factory()->cons_one_byte_string_map()));
2121  }
2122  if_onebyte.Else();
2123  {
2124  // We can safely skip the write barrier for storing the map here.
2125  Add<HStoreNamedField>(
2126  result, HObjectAccess::ForMap(),
2127  Add<HConstant>(isolate()->factory()->cons_string_map()));
2128  }
2129  if_onebyte.End();
2130 
2131  // Initialize the cons string fields.
2132  Add<HStoreNamedField>(result, HObjectAccess::ForStringHashField(),
2133  Add<HConstant>(String::kEmptyHashField));
2134  Add<HStoreNamedField>(result, HObjectAccess::ForStringLength(), length);
2135  Add<HStoreNamedField>(result, HObjectAccess::ForConsStringFirst(), left);
2136  Add<HStoreNamedField>(result, HObjectAccess::ForConsStringSecond(), right);
2137 
2138  // Count the native string addition.
2139  AddIncrementCounter(isolate()->counters()->string_add_native());
2140 
2141  return result;
2142 }
static const int kSize
Definition: objects.h:9063
HAllocate * BuildAllocate(HValue *object_size, HType type, InstanceType instance_type, HAllocationMode allocation_mode)
Definition: hydrogen.cc:2023
HInstruction * AddLoadStringInstanceType(HValue *string)
Definition: hydrogen.cc:6793
static const int kEmptyHashField
Definition: objects.h:8534
const uint32_t kStringEncodingMask
Definition: objects.h:555
@ CONS_ONE_BYTE_STRING_TYPE
Definition: objects.h:636
@ CONS_STRING_TYPE
Definition: objects.h:635
const uint32_t kOneByteStringTag
Definition: objects.h:557
const uint32_t kOneByteDataHintMask
Definition: objects.h:584
const uint32_t kOneByteDataHintTag
Definition: objects.h:585

References v8::internal::CONS_ONE_BYTE_STRING_TYPE, v8::internal::CONS_STRING_TYPE, DCHECK, v8::internal::EQ, v8::internal::kOneByteDataHintMask, v8::internal::kOneByteDataHintTag, v8::internal::kOneByteStringTag, v8::internal::kStringEncodingMask, and STATIC_ASSERT.

◆ BuildDecodeField()

template<class BitFieldClass >
HValue* v8::internal::HGraphBuilder::BuildDecodeField ( HValue encoded_field)
inlineprotected

Definition at line 1317 of file hydrogen.h.

1317  {
1318  HValue* mask_value = Add<HConstant>(static_cast<int>(BitFieldClass::kMask));
1319  HValue* masked_field =
1320  AddUncasted<HBitwise>(Token::BIT_AND, encoded_field, mask_value);
1321  return AddUncasted<HShr>(masked_field,
1322  Add<HConstant>(static_cast<int>(BitFieldClass::kShift)));
1323  }

◆ BuildElementIndexHash()

HValue * v8::internal::HGraphBuilder::BuildElementIndexHash ( HValue index)
protected

Definition at line 1634 of file hydrogen.cc.

1634  {
1635  int32_t seed_value = static_cast<uint32_t>(isolate()->heap()->HashSeed());
1636  HValue* seed = Add<HConstant>(seed_value);
1637  HValue* hash = AddUncasted<HBitwise>(Token::BIT_XOR, index, seed);
1638 
1639  // hash = ~hash + (hash << 15);
1640  HValue* shifted_hash = AddUncasted<HShl>(hash, Add<HConstant>(15));
1641  HValue* not_hash = AddUncasted<HBitwise>(Token::BIT_XOR, hash,
1642  graph()->GetConstantMinus1());
1643  hash = AddUncasted<HAdd>(shifted_hash, not_hash);
1644 
1645  // hash = hash ^ (hash >> 12);
1646  shifted_hash = AddUncasted<HShr>(hash, Add<HConstant>(12));
1647  hash = AddUncasted<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
1648 
1649  // hash = hash + (hash << 2);
1650  shifted_hash = AddUncasted<HShl>(hash, Add<HConstant>(2));
1651  hash = AddUncasted<HAdd>(hash, shifted_hash);
1652 
1653  // hash = hash ^ (hash >> 4);
1654  shifted_hash = AddUncasted<HShr>(hash, Add<HConstant>(4));
1655  hash = AddUncasted<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
1656 
1657  // hash = hash * 2057;
1658  hash = AddUncasted<HMul>(hash, Add<HConstant>(2057));
1659  hash->ClearFlag(HValue::kCanOverflow);
1660 
1661  // hash = hash ^ (hash >> 16);
1662  shifted_hash = AddUncasted<HShr>(hash, Add<HConstant>(16));
1663  return AddUncasted<HBitwise>(Token::BIT_XOR, hash, shifted_hash);
1664 }
uint32_t HashSeed()
Definition: heap.h:1237

References v8::internal::HValue::ClearFlag().

Referenced by v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildFillElementsWithHole()

void v8::internal::HGraphBuilder::BuildFillElementsWithHole ( HValue elements,
ElementsKind  elements_kind,
HValue from,
HValue to 
)
protected

Definition at line 2822 of file hydrogen.cc.

2825  {
2826  // Fast elements kinds need to be initialized in case statements below cause a
2827  // garbage collection.
2828  Factory* factory = isolate()->factory();
2829 
2830  double nan_double = FixedDoubleArray::hole_nan_as_double();
2831  HValue* hole = IsFastSmiOrObjectElementsKind(elements_kind)
2832  ? Add<HConstant>(factory->the_hole_value())
2833  : Add<HConstant>(nan_double);
2834 
2835  BuildFillElementsWithValue(elements, elements_kind, from, to, hole);
2836 }
void BuildFillElementsWithValue(HValue *elements, ElementsKind elements_kind, HValue *from, HValue *to, HValue *value)
Definition: hydrogen.cc:2770
enable harmony numeric enable harmony object literal extensions Optimize object Array DOM strings and string trace pretenuring decisions of HAllocate instructions Enables optimizations which favor memory size over execution speed maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining trace the tracking of allocation sites deoptimize every n garbage collections perform array bounds checks elimination analyze liveness of environment slots and zap dead values flushes the cache of optimized code for closures on every GC allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes enable context specialization in TurboFan execution budget before interrupt is triggered max percentage of megamorphic generic ICs to allow optimization enable use of SAHF instruction if enable use of VFP3 instructions if available enable use of NEON instructions if enable use of SDIV and UDIV instructions if enable use of MLS instructions if enable loading bit constant by means of movw movt instruction enable unaligned accesses for enable use of d16 d31 registers on ARM this requires VFP3 force all emitted branches to be in long enable alignment of csp to bytes on platforms which prefer the register to always be expose gc extension under the specified name show built in functions in stack traces use random jit cookie to mask large constants minimum length for automatic enable preparsing CPU profiler sampling interval in microseconds trace out of bounds accesses to external arrays default size of stack region v8 is allowed to maximum length of function source code printed in a stack trace min size of a semi the new space consists of two semi spaces print one trace line following each garbage collection do not print trace line after scavenger collection print cumulative GC statistics in only print modified registers Trace simulator debug messages Implied by trace sim abort randomize hashes to avoid predictable hash Fixed seed to use to hash property Print the time it takes to deserialize the snapshot A filename with extra code to be included in the A file to write the raw snapshot bytes to(mksnapshot only)") DEFINE_STRING(raw_context_file
bool IsFastSmiOrObjectElementsKind(ElementsKind kind)

References v8::internal::IsFastSmiOrObjectElementsKind(), and to().

+ Here is the call graph for this function:

◆ BuildFillElementsWithValue()

void v8::internal::HGraphBuilder::BuildFillElementsWithValue ( HValue elements,
ElementsKind  elements_kind,
HValue from,
HValue to,
HValue value 
)
protected

Definition at line 2770 of file hydrogen.cc.

2774  {
2775  if (to == NULL) {
2776  to = AddLoadFixedArrayLength(elements);
2777  }
2778 
2779  // Special loop unfolding case
2782  int initial_capacity = -1;
2783  if (from->IsInteger32Constant() && to->IsInteger32Constant()) {
2784  int constant_from = from->GetInteger32Constant();
2785  int constant_to = to->GetInteger32Constant();
2786 
2787  if (constant_from == 0 && constant_to <= kElementLoopUnrollThreshold) {
2788  initial_capacity = constant_to;
2789  }
2790  }
2791 
2792  // Since we're about to store a hole value, the store instruction below must
2793  // assume an elements kind that supports heap object values.
2794  if (IsFastSmiOrObjectElementsKind(elements_kind)) {
2795  elements_kind = FAST_HOLEY_ELEMENTS;
2796  }
2797 
2798  if (initial_capacity >= 0) {
2799  for (int i = 0; i < initial_capacity; i++) {
2800  HInstruction* key = Add<HConstant>(i);
2801  Add<HStoreKeyed>(elements, key, value, elements_kind);
2802  }
2803  } else {
2804  // Carefully loop backwards so that the "from" remains live through the loop
2805  // rather than the to. This often corresponds to keeping length live rather
2806  // then capacity, which helps register allocation, since length is used more
2807  // other than capacity after filling with holes.
2808  LoopBuilder builder(this, context(), LoopBuilder::kPostDecrement);
2809 
2810  HValue* key = builder.BeginBody(to, from, Token::GT);
2811 
2812  HValue* adjusted_key = AddUncasted<HSub>(key, graph()->GetConstant1());
2813  adjusted_key->ClearFlag(HValue::kCanOverflow);
2814 
2815  Add<HStoreKeyed>(elements, adjusted_key, value, elements_kind);
2816 
2817  builder.EndBody();
2818  }
2819 }

References v8::internal::HValue::ClearFlag(), v8::internal::FAST_HOLEY_ELEMENTS, v8::internal::HValue::GetInteger32Constant(), v8::internal::IsFastSmiOrObjectElementsKind(), v8::internal::HValue::IsInteger32Constant(), NULL, STATIC_ASSERT, and to().

+ Here is the call graph for this function:

◆ BuildGetArrayFunction()

HInstruction * v8::internal::HGraphBuilder::BuildGetArrayFunction ( )
protected

Definition at line 3132 of file hydrogen.cc.

3132  {
3133  HInstruction* native_context = BuildGetNativeContext();
3134  HInstruction* index =
3135  Add<HConstant>(static_cast<int32_t>(Context::ARRAY_FUNCTION_INDEX));
3136  return Add<HLoadKeyed>(
3137  native_context, index, static_cast<HValue*>(NULL), FAST_ELEMENTS);
3138 }
HInstruction * BuildGetNativeContext()
Definition: hydrogen.cc:3120

References v8::internal::FAST_ELEMENTS, and NULL.

◆ BuildGetElementsKind()

HValue * v8::internal::HGraphBuilder::BuildGetElementsKind ( HValue object)
protected

Definition at line 1256 of file hydrogen.cc.

1256  {
1257  HValue* map = Add<HLoadNamedField>(object, static_cast<HValue*>(NULL),
1258  HObjectAccess::ForMap());
1259 
1260  HValue* bit_field2 = Add<HLoadNamedField>(map, static_cast<HValue*>(NULL),
1261  HObjectAccess::ForMapBitField2());
1262  return BuildDecodeField<Map::ElementsKindBits>(bit_field2);
1263 }

References map, and NULL.

◆ BuildGetNativeContext() [1/2]

HInstruction * v8::internal::HGraphBuilder::BuildGetNativeContext ( )
protected

Definition at line 3120 of file hydrogen.cc.

3120  {
3121  // Get the global context, then the native context
3122  HValue* global_object = Add<HLoadNamedField>(
3123  context(), static_cast<HValue*>(NULL),
3124  HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
3125  return Add<HLoadNamedField>(
3126  global_object, static_cast<HValue*>(NULL),
3127  HObjectAccess::ForObservableJSObjectOffset(
3129 }
static const int kNativeContextOffset
Definition: objects.h:7459

References NULL.

◆ BuildGetNativeContext() [2/2]

HInstruction * v8::internal::HGraphBuilder::BuildGetNativeContext ( HValue closure)
protected

Definition at line 3105 of file hydrogen.cc.

3105  {
3106  // Get the global context, then the native context
3107  HInstruction* context =
3108  Add<HLoadNamedField>(closure, static_cast<HValue*>(NULL),
3109  HObjectAccess::ForFunctionContextPointer());
3110  HInstruction* global_object = Add<HLoadNamedField>(
3111  context, static_cast<HValue*>(NULL),
3112  HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
3113  HObjectAccess access = HObjectAccess::ForObservableJSObjectOffset(
3115  return Add<HLoadNamedField>(
3116  global_object, static_cast<HValue*>(NULL), access);
3117 }

References NULL.

◆ BuildGraph()

virtual bool v8::internal::HGraphBuilder::BuildGraph ( )
protectedpure virtual

◆ BuildGrowElementsCapacity()

HValue * v8::internal::HGraphBuilder::BuildGrowElementsCapacity ( HValue object,
HValue elements,
ElementsKind  kind,
ElementsKind  new_kind,
HValue length,
HValue new_capacity 
)
protected

Definition at line 2747 of file hydrogen.cc.

2752  {
2753  Add<HBoundsCheck>(new_capacity, Add<HConstant>(
2755  ElementsKindToShiftSize(new_kind)));
2756 
2757  HValue* new_elements = BuildAllocateElementsAndInitializeElementsHeader(
2758  new_kind, new_capacity);
2759 
2760  BuildCopyElements(elements, kind, new_elements,
2761  new_kind, length, new_capacity);
2762 
2763  Add<HStoreNamedField>(object, HObjectAccess::ForElementsPointer(),
2764  new_elements);
2765 
2766  return new_elements;
2767 }
HValue * BuildAllocateElementsAndInitializeElementsHeader(ElementsKind kind, HValue *capacity)
Definition: hydrogen.cc:2629
static const int kMaxRegularHeapObjectSize
Definition: spaces.h:754
int ElementsKindToShiftSize(ElementsKind elements_kind)

References v8::internal::ElementsKindToShiftSize().

+ Here is the call graph for this function:

◆ BuildInitializeElementsHeader()

void v8::internal::HGraphBuilder::BuildInitializeElementsHeader ( HValue elements,
ElementsKind  kind,
HValue capacity 
)
protected

Definition at line 2615 of file hydrogen.cc.

2617  {
2618  Factory* factory = isolate()->factory();
2619  Handle<Map> map = IsFastDoubleElementsKind(kind)
2620  ? factory->fixed_double_array_map()
2621  : factory->fixed_array_map();
2622 
2623  Add<HStoreNamedField>(elements, HObjectAccess::ForMap(), Add<HConstant>(map));
2624  Add<HStoreNamedField>(elements, HObjectAccess::ForFixedArrayLength(),
2625  capacity);
2626 }

References v8::internal::IsFastDoubleElementsKind(), and map.

Referenced by v8::internal::HOptimizedGraphBuilder::BuildEmitElements().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildJSArrayHeader()

void v8::internal::HGraphBuilder::BuildJSArrayHeader ( HValue array,
HValue array_map,
HValue elements,
AllocationSiteMode  mode,
ElementsKind  elements_kind,
HValue allocation_site_payload,
HValue length_field 
)
protected

Definition at line 2642 of file hydrogen.cc.

2648  {
2649  Add<HStoreNamedField>(array, HObjectAccess::ForMap(), array_map);
2650 
2651  HConstant* empty_fixed_array =
2652  Add<HConstant>(isolate()->factory()->empty_fixed_array());
2653 
2654  Add<HStoreNamedField>(
2655  array, HObjectAccess::ForPropertiesPointer(), empty_fixed_array);
2656 
2657  Add<HStoreNamedField>(
2658  array, HObjectAccess::ForElementsPointer(),
2659  elements != NULL ? elements : empty_fixed_array);
2660 
2661  Add<HStoreNamedField>(
2662  array, HObjectAccess::ForArrayLength(elements_kind), length_field);
2663 
2664  if (mode == TRACK_ALLOCATION_SITE) {
2666  array, Add<HConstant>(JSArray::kSize), allocation_site_payload);
2667  }
2668 }

References mode(), NULL, and v8::internal::TRACK_ALLOCATION_SITE.

+ Here is the call graph for this function:

◆ BuildJSObjectCheck()

void v8::internal::HGraphBuilder::BuildJSObjectCheck ( HValue receiver,
int  bit_field_mask 
)
protected

Definition at line 1435 of file hydrogen.cc.

1436  {
1437  // Check that the object isn't a smi.
1438  Add<HCheckHeapObject>(receiver);
1439 
1440  // Get the map of the receiver.
1441  HValue* map = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL),
1442  HObjectAccess::ForMap());
1443 
1444  // Check the instance type and if an access check is needed, this can be
1445  // done with a single load, since both bytes are adjacent in the map.
1446  HObjectAccess access(HObjectAccess::ForMapInstanceTypeAndBitField());
1447  HValue* instance_type_and_bit_field =
1448  Add<HLoadNamedField>(map, static_cast<HValue*>(NULL), access);
1449 
1450  HValue* mask = Add<HConstant>(0x00FF | (bit_field_mask << 8));
1451  HValue* and_result = AddUncasted<HBitwise>(Token::BIT_AND,
1452  instance_type_and_bit_field,
1453  mask);
1454  HValue* sub_result = AddUncasted<HSub>(and_result,
1455  Add<HConstant>(JS_OBJECT_TYPE));
1456  Add<HBoundsCheck>(sub_result,
1457  Add<HConstant>(LAST_JS_OBJECT_TYPE + 1 - JS_OBJECT_TYPE));
1458 }
@ LAST_JS_OBJECT_TYPE
Definition: objects.h:776

References v8::internal::JS_OBJECT_TYPE, v8::internal::LAST_JS_OBJECT_TYPE, map, and NULL.

Referenced by v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub().

+ Here is the caller graph for this function:

◆ BuildKeyedIndexCheck()

void v8::internal::HGraphBuilder::BuildKeyedIndexCheck ( HValue key,
HIfContinuation *  join_continuation 
)
protected

Definition at line 1461 of file hydrogen.cc.

1462  {
1463  // The sometimes unintuitively backward ordering of the ifs below is
1464  // convoluted, but necessary. All of the paths must guarantee that the
1465  // if-true of the continuation returns a smi element index and the if-false of
1466  // the continuation returns either a symbol or a unique string key. All other
1467  // object types cause a deopt to fall back to the runtime.
1468 
1469  IfBuilder key_smi_if(this);
1470  key_smi_if.If<HIsSmiAndBranch>(key);
1471  key_smi_if.Then();
1472  {
1473  Push(key); // Nothing to do, just continue to true of continuation.
1474  }
1475  key_smi_if.Else();
1476  {
1477  HValue* map = Add<HLoadNamedField>(key, static_cast<HValue*>(NULL),
1478  HObjectAccess::ForMap());
1479  HValue* instance_type =
1480  Add<HLoadNamedField>(map, static_cast<HValue*>(NULL),
1481  HObjectAccess::ForMapInstanceType());
1482 
1483  // Non-unique string, check for a string with a hash code that is actually
1484  // an index.
1486  IfBuilder not_string_or_name_if(this);
1487  not_string_or_name_if.If<HCompareNumericAndBranch>(
1488  instance_type,
1489  Add<HConstant>(LAST_UNIQUE_NAME_TYPE),
1490  Token::GT);
1491 
1492  not_string_or_name_if.Then();
1493  {
1494  // Non-smi, non-Name, non-String: Try to convert to smi in case of
1495  // HeapNumber.
1496  // TODO(danno): This could call some variant of ToString
1497  Push(AddUncasted<HForceRepresentation>(key, Representation::Smi()));
1498  }
1499  not_string_or_name_if.Else();
1500  {
1501  // String or Name: check explicitly for Name, they can short-circuit
1502  // directly to unique non-index key path.
1503  IfBuilder not_symbol_if(this);
1504  not_symbol_if.If<HCompareNumericAndBranch>(
1505  instance_type,
1506  Add<HConstant>(SYMBOL_TYPE),
1507  Token::NE);
1508 
1509  not_symbol_if.Then();
1510  {
1511  // String: check whether the String is a String of an index. If it is,
1512  // extract the index value from the hash.
1513  HValue* hash =
1514  Add<HLoadNamedField>(key, static_cast<HValue*>(NULL),
1515  HObjectAccess::ForNameHashField());
1516  HValue* not_index_mask = Add<HConstant>(static_cast<int>(
1518 
1519  HValue* not_index_test = AddUncasted<HBitwise>(
1520  Token::BIT_AND, hash, not_index_mask);
1521 
1522  IfBuilder string_index_if(this);
1523  string_index_if.If<HCompareNumericAndBranch>(not_index_test,
1524  graph()->GetConstant0(),
1525  Token::EQ);
1526  string_index_if.Then();
1527  {
1528  // String with index in hash: extract string and merge to index path.
1529  Push(BuildDecodeField<String::ArrayIndexValueBits>(hash));
1530  }
1531  string_index_if.Else();
1532  {
1533  // Key is a non-index String, check for uniqueness/internalization.
1534  // If it's not internalized yet, internalize it now.
1535  HValue* not_internalized_bit = AddUncasted<HBitwise>(
1536  Token::BIT_AND,
1537  instance_type,
1538  Add<HConstant>(static_cast<int>(kIsNotInternalizedMask)));
1539 
1540  IfBuilder internalized(this);
1541  internalized.If<HCompareNumericAndBranch>(not_internalized_bit,
1542  graph()->GetConstant0(),
1543  Token::EQ);
1544  internalized.Then();
1545  Push(key);
1546 
1547  internalized.Else();
1548  Add<HPushArguments>(key);
1549  HValue* intern_key = Add<HCallRuntime>(
1550  isolate()->factory()->empty_string(),
1551  Runtime::FunctionForId(Runtime::kInternalizeString), 1);
1552  Push(intern_key);
1553 
1554  internalized.End();
1555  // Key guaranteed to be a unique string
1556  }
1557  string_index_if.JoinContinuation(join_continuation);
1558  }
1559  not_symbol_if.Else();
1560  {
1561  Push(key); // Key is symbol
1562  }
1563  not_symbol_if.JoinContinuation(join_continuation);
1564  }
1565  not_string_or_name_if.JoinContinuation(join_continuation);
1566  }
1567  key_smi_if.JoinContinuation(join_continuation);
1568 }
static const Function * FunctionForId(FunctionId id)
Definition: runtime.cc:9312
static const unsigned int kContainsCachedArrayIndexMask
Definition: objects.h:8618
@ FIRST_NONSTRING_TYPE
Definition: objects.h:758
@ LAST_UNIQUE_NAME_TYPE
Definition: objects.h:757
const uint32_t kIsNotInternalizedMask
Definition: objects.h:549

References v8::internal::EQ, v8::internal::FIRST_NONSTRING_TYPE, v8::internal::kIsNotInternalizedMask, v8::internal::LAST_UNIQUE_NAME_TYPE, map, NULL, v8::internal::compiler::Push(), STATIC_ASSERT, and v8::internal::SYMBOL_TYPE.

Referenced by v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildKeyedLookupCacheHash()

HValue * v8::internal::HGraphBuilder::BuildKeyedLookupCacheHash ( HValue object,
HValue key 
)
protected

Definition at line 1612 of file hydrogen.cc.

1613  {
1614  // Load the map of the receiver, compute the keyed lookup cache hash
1615  // based on 32 bits of the map pointer and the string hash.
1616  HValue* object_map =
1617  Add<HLoadNamedField>(object, static_cast<HValue*>(NULL),
1618  HObjectAccess::ForMapAsInteger32());
1619  HValue* shifted_map = AddUncasted<HShr>(
1620  object_map, Add<HConstant>(KeyedLookupCache::kMapHashShift));
1621  HValue* string_hash =
1622  Add<HLoadNamedField>(key, static_cast<HValue*>(NULL),
1623  HObjectAccess::ForStringHashField());
1624  HValue* shifted_hash = AddUncasted<HShr>(
1625  string_hash, Add<HConstant>(String::kHashShift));
1626  HValue* xor_result = AddUncasted<HBitwise>(Token::BIT_XOR, shifted_map,
1627  shifted_hash);
1629  return AddUncasted<HBitwise>(Token::BIT_AND, xor_result,
1630  Add<HConstant>(mask));
1631 }
static const int kHashMask
Definition: heap.h:2255
static const int kCapacityMask
Definition: heap.h:2253
static const int kMapHashShift
Definition: heap.h:2254
static const int kHashShift
Definition: objects.h:8499

References NULL.

Referenced by v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub().

+ Here is the caller graph for this function:

◆ BuildNewElementsCapacity()

HValue * v8::internal::HGraphBuilder::BuildNewElementsCapacity ( HValue old_capacity)
protected

Definition at line 2731 of file hydrogen.cc.

2731  {
2732  HValue* half_old_capacity = AddUncasted<HShr>(old_capacity,
2733  graph_->GetConstant1());
2734 
2735  HValue* new_capacity = AddUncasted<HAdd>(half_old_capacity, old_capacity);
2736  new_capacity->ClearFlag(HValue::kCanOverflow);
2737 
2738  HValue* min_growth = Add<HConstant>(16);
2739 
2740  new_capacity = AddUncasted<HAdd>(new_capacity, min_growth);
2741  new_capacity->ClearFlag(HValue::kCanOverflow);
2742 
2743  return new_capacity;
2744 }

References v8::internal::HValue::ClearFlag().

+ Here is the call graph for this function:

◆ BuildNonGlobalObjectCheck()

void v8::internal::HGraphBuilder::BuildNonGlobalObjectCheck ( HValue receiver)
protected

Definition at line 1571 of file hydrogen.cc.

1571  {
1572  // Get the the instance type of the receiver, and make sure that it is
1573  // not one of the global object types.
1574  HValue* map = Add<HLoadNamedField>(receiver, static_cast<HValue*>(NULL),
1575  HObjectAccess::ForMap());
1576  HValue* instance_type =
1577  Add<HLoadNamedField>(map, static_cast<HValue*>(NULL),
1578  HObjectAccess::ForMapInstanceType());
1580  HValue* min_global_type = Add<HConstant>(JS_GLOBAL_OBJECT_TYPE);
1581  HValue* max_global_type = Add<HConstant>(JS_BUILTINS_OBJECT_TYPE);
1582 
1583  IfBuilder if_global_object(this);
1584  if_global_object.If<HCompareNumericAndBranch>(instance_type,
1585  max_global_type,
1586  Token::LTE);
1587  if_global_object.And();
1588  if_global_object.If<HCompareNumericAndBranch>(instance_type,
1589  min_global_type,
1590  Token::GTE);
1591  if_global_object.ThenDeopt("receiver was a global object");
1592  if_global_object.End();
1593 }
@ JS_GLOBAL_OBJECT_TYPE
Definition: objects.h:735
@ JS_BUILTINS_OBJECT_TYPE
Definition: objects.h:736

References v8::internal::JS_BUILTINS_OBJECT_TYPE, v8::internal::JS_GLOBAL_OBJECT_TYPE, map, NULL, and STATIC_ASSERT.

Referenced by v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub().

+ Here is the caller graph for this function:

◆ BuildNumberToString()

HValue * v8::internal::HGraphBuilder::BuildNumberToString ( HValue object,
Type type 
)
protected

Definition at line 1878 of file hydrogen.cc.

1878  {
1879  NoObservableSideEffectsScope scope(this);
1880 
1881  // Convert constant numbers at compile time.
1882  if (object->IsConstant() && HConstant::cast(object)->HasNumberValue()) {
1883  Handle<Object> number = HConstant::cast(object)->handle(isolate());
1884  Handle<String> result = isolate()->factory()->NumberToString(number);
1885  return Add<HConstant>(result);
1886  }
1887 
1888  // Create a joinable continuation.
1889  HIfContinuation found(graph()->CreateBasicBlock(),
1890  graph()->CreateBasicBlock());
1891 
1892  // Load the number string cache.
1893  HValue* number_string_cache =
1894  Add<HLoadRoot>(Heap::kNumberStringCacheRootIndex);
1895 
1896  // Make the hash mask from the length of the number string cache. It
1897  // contains two elements (number and string) for each cache entry.
1898  HValue* mask = AddLoadFixedArrayLength(number_string_cache);
1899  mask->set_type(HType::Smi());
1900  mask = AddUncasted<HSar>(mask, graph()->GetConstant1());
1901  mask = AddUncasted<HSub>(mask, graph()->GetConstant1());
1902 
1903  // Check whether object is a smi.
1904  IfBuilder if_objectissmi(this);
1905  if_objectissmi.If<HIsSmiAndBranch>(object);
1906  if_objectissmi.Then();
1907  {
1908  // Compute hash for smi similar to smi_get_hash().
1909  HValue* hash = AddUncasted<HBitwise>(Token::BIT_AND, object, mask);
1910 
1911  // Load the key.
1912  HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1());
1913  HValue* key = Add<HLoadKeyed>(number_string_cache, key_index,
1914  static_cast<HValue*>(NULL),
1916 
1917  // Check if object == key.
1918  IfBuilder if_objectiskey(this);
1919  if_objectiskey.If<HCompareObjectEqAndBranch>(object, key);
1920  if_objectiskey.Then();
1921  {
1922  // Make the key_index available.
1923  Push(key_index);
1924  }
1925  if_objectiskey.JoinContinuation(&found);
1926  }
1927  if_objectissmi.Else();
1928  {
1929  if (type->Is(Type::SignedSmall())) {
1930  if_objectissmi.Deopt("Expected smi");
1931  } else {
1932  // Check if the object is a heap number.
1933  IfBuilder if_objectisnumber(this);
1934  HValue* objectisnumber = if_objectisnumber.If<HCompareMap>(
1935  object, isolate()->factory()->heap_number_map());
1936  if_objectisnumber.Then();
1937  {
1938  // Compute hash for heap number similar to double_get_hash().
1939  HValue* low = Add<HLoadNamedField>(
1940  object, objectisnumber,
1941  HObjectAccess::ForHeapNumberValueLowestBits());
1942  HValue* high = Add<HLoadNamedField>(
1943  object, objectisnumber,
1944  HObjectAccess::ForHeapNumberValueHighestBits());
1945  HValue* hash = AddUncasted<HBitwise>(Token::BIT_XOR, low, high);
1946  hash = AddUncasted<HBitwise>(Token::BIT_AND, hash, mask);
1947 
1948  // Load the key.
1949  HValue* key_index = AddUncasted<HShl>(hash, graph()->GetConstant1());
1950  HValue* key = Add<HLoadKeyed>(number_string_cache, key_index,
1951  static_cast<HValue*>(NULL),
1953 
1954  // Check if the key is a heap number and compare it with the object.
1955  IfBuilder if_keyisnotsmi(this);
1956  HValue* keyisnotsmi = if_keyisnotsmi.IfNot<HIsSmiAndBranch>(key);
1957  if_keyisnotsmi.Then();
1958  {
1959  IfBuilder if_keyisheapnumber(this);
1960  if_keyisheapnumber.If<HCompareMap>(
1961  key, isolate()->factory()->heap_number_map());
1962  if_keyisheapnumber.Then();
1963  {
1964  // Check if values of key and object match.
1965  IfBuilder if_keyeqobject(this);
1966  if_keyeqobject.If<HCompareNumericAndBranch>(
1967  Add<HLoadNamedField>(key, keyisnotsmi,
1968  HObjectAccess::ForHeapNumberValue()),
1969  Add<HLoadNamedField>(object, objectisnumber,
1970  HObjectAccess::ForHeapNumberValue()),
1971  Token::EQ);
1972  if_keyeqobject.Then();
1973  {
1974  // Make the key_index available.
1975  Push(key_index);
1976  }
1977  if_keyeqobject.JoinContinuation(&found);
1978  }
1979  if_keyisheapnumber.JoinContinuation(&found);
1980  }
1981  if_keyisnotsmi.JoinContinuation(&found);
1982  }
1983  if_objectisnumber.Else();
1984  {
1985  if (type->Is(Type::Number())) {
1986  if_objectisnumber.Deopt("Expected heap number");
1987  }
1988  }
1989  if_objectisnumber.JoinContinuation(&found);
1990  }
1991  }
1992  if_objectissmi.JoinContinuation(&found);
1993 
1994  // Check for cache hit.
1995  IfBuilder if_found(this, &found);
1996  if_found.Then();
1997  {
1998  // Count number to string operation in native code.
1999  AddIncrementCounter(isolate()->counters()->number_to_string_native());
2000 
2001  // Load the value in case of cache hit.
2002  HValue* key_index = Pop();
2003  HValue* value_index = AddUncasted<HAdd>(key_index, graph()->GetConstant1());
2004  Push(Add<HLoadKeyed>(number_string_cache, value_index,
2005  static_cast<HValue*>(NULL),
2007  }
2008  if_found.Else();
2009  {
2010  // Cache miss, fallback to runtime.
2011  Add<HPushArguments>(object);
2012  Push(Add<HCallRuntime>(
2013  isolate()->factory()->empty_string(),
2014  Runtime::FunctionForId(Runtime::kNumberToStringSkipCache),
2015  1));
2016  }
2017  if_found.End();
2018 
2019  return Pop();
2020 }
Scope * scope() const
Definition: hydrogen.h:1054

References v8::internal::ALLOW_RETURN_HOLE, v8::internal::EQ, v8::internal::FAST_ELEMENTS, v8::internal::TypeImpl< Config >::Is(), NULL, v8::internal::compiler::Push(), and v8::internal::HValue::set_type().

Referenced by BuildBinaryOperation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildObjectSizeAlignment()

HValue * v8::internal::HGraphBuilder::BuildObjectSizeAlignment ( HValue unaligned_size,
int  header_size 
)
protected

Definition at line 2167 of file hydrogen.cc.

2168  {
2169  DCHECK((header_size & kObjectAlignmentMask) == 0);
2170  HValue* size = AddUncasted<HAdd>(
2171  unaligned_size, Add<HConstant>(static_cast<int32_t>(
2172  header_size + kObjectAlignmentMask)));
2173  size->ClearFlag(HValue::kCanOverflow);
2174  return AddUncasted<HBitwise>(
2175  Token::BIT_AND, size, Add<HConstant>(static_cast<int32_t>(
2177 }
const intptr_t kObjectAlignmentMask
Definition: globals.h:227

References DCHECK, v8::internal::kObjectAlignmentMask, and size.

Referenced by v8::internal::HOptimizedGraphBuilder::BuildAllocateFixedTypedArray().

+ Here is the caller graph for this function:

◆ BuildRegExpConstructResult()

HValue * v8::internal::HGraphBuilder::BuildRegExpConstructResult ( HValue length,
HValue index,
HValue input 
)
protected

Definition at line 1807 of file hydrogen.cc.

1809  {
1810  NoObservableSideEffectsScope scope(this);
1811  HConstant* max_length = Add<HConstant>(JSObject::kInitialMaxFastElementArray);
1812  Add<HBoundsCheck>(length, max_length);
1813 
1814  // Generate size calculation code here in order to make it dominate
1815  // the JSRegExpResult allocation.
1816  ElementsKind elements_kind = FAST_ELEMENTS;
1817  HValue* size = BuildCalculateElementsSize(elements_kind, length);
1818 
1819  // Allocate the JSRegExpResult and the FixedArray in one step.
1820  HValue* result = Add<HAllocate>(
1821  Add<HConstant>(JSRegExpResult::kSize), HType::JSArray(),
1823 
1824  // Initialize the JSRegExpResult header.
1825  HValue* global_object = Add<HLoadNamedField>(
1826  context(), static_cast<HValue*>(NULL),
1827  HObjectAccess::ForContextSlot(Context::GLOBAL_OBJECT_INDEX));
1828  HValue* native_context = Add<HLoadNamedField>(
1829  global_object, static_cast<HValue*>(NULL),
1830  HObjectAccess::ForGlobalObjectNativeContext());
1831  Add<HStoreNamedField>(
1832  result, HObjectAccess::ForMap(),
1833  Add<HLoadNamedField>(
1834  native_context, static_cast<HValue*>(NULL),
1835  HObjectAccess::ForContextSlot(Context::REGEXP_RESULT_MAP_INDEX)));
1836  HConstant* empty_fixed_array =
1837  Add<HConstant>(isolate()->factory()->empty_fixed_array());
1838  Add<HStoreNamedField>(
1839  result, HObjectAccess::ForJSArrayOffset(JSArray::kPropertiesOffset),
1840  empty_fixed_array);
1841  Add<HStoreNamedField>(
1842  result, HObjectAccess::ForJSArrayOffset(JSArray::kElementsOffset),
1843  empty_fixed_array);
1844  Add<HStoreNamedField>(
1845  result, HObjectAccess::ForJSArrayOffset(JSArray::kLengthOffset), length);
1846 
1847  // Initialize the additional fields.
1848  Add<HStoreNamedField>(
1849  result, HObjectAccess::ForJSArrayOffset(JSRegExpResult::kIndexOffset),
1850  index);
1851  Add<HStoreNamedField>(
1852  result, HObjectAccess::ForJSArrayOffset(JSRegExpResult::kInputOffset),
1853  input);
1854 
1855  // Allocate and initialize the elements header.
1856  HAllocate* elements = BuildAllocateElements(elements_kind, size);
1857  BuildInitializeElementsHeader(elements, elements_kind, length);
1858 
1859  if (!elements->has_size_upper_bound()) {
1860  HConstant* size_in_bytes_upper_bound = EstablishElementsAllocationSize(
1861  elements_kind, max_length->Integer32Value());
1862  elements->set_size_upper_bound(size_in_bytes_upper_bound);
1863  }
1864 
1865  Add<HStoreNamedField>(
1866  result, HObjectAccess::ForJSArrayOffset(JSArray::kElementsOffset),
1867  elements);
1868 
1869  // Initialize the elements contents with undefined.
1871  elements, elements_kind, graph()->GetConstant0(), length,
1872  graph()->GetConstantUndefined());
1873 
1874  return result;
1875 }
static const int kLengthOffset
Definition: objects.h:10072
static const int kPropertiesOffset
Definition: objects.h:2193
static const int kElementsOffset
Definition: objects.h:2194
static const int kInputOffset
Definition: objects.h:10094
static const int kIndexOffset
Definition: objects.h:10093
static const int kSize
Definition: objects.h:10095
@ JS_ARRAY_TYPE
Definition: objects.h:738

References v8::internal::FAST_ELEMENTS, v8::internal::JS_ARRAY_TYPE, v8::internal::NOT_TENURED, NULL, and size.

◆ BuildStringAdd()

HValue * v8::internal::HGraphBuilder::BuildStringAdd ( HValue left,
HValue right,
HAllocationMode  allocation_mode 
)
protected

Definition at line 2349 of file hydrogen.cc.

2352  {
2353  NoObservableSideEffectsScope no_effects(this);
2354 
2355  // Determine string lengths.
2356  HValue* left_length = AddLoadStringLength(left);
2357  HValue* right_length = AddLoadStringLength(right);
2358 
2359  // Check if left string is empty.
2360  IfBuilder if_leftempty(this);
2361  if_leftempty.If<HCompareNumericAndBranch>(
2362  left_length, graph()->GetConstant0(), Token::EQ);
2363  if_leftempty.Then();
2364  {
2365  // Count the native string addition.
2366  AddIncrementCounter(isolate()->counters()->string_add_native());
2367 
2368  // Just return the right string.
2369  Push(right);
2370  }
2371  if_leftempty.Else();
2372  {
2373  // Check if right string is empty.
2374  IfBuilder if_rightempty(this);
2375  if_rightempty.If<HCompareNumericAndBranch>(
2376  right_length, graph()->GetConstant0(), Token::EQ);
2377  if_rightempty.Then();
2378  {
2379  // Count the native string addition.
2380  AddIncrementCounter(isolate()->counters()->string_add_native());
2381 
2382  // Just return the left string.
2383  Push(left);
2384  }
2385  if_rightempty.Else();
2386  {
2387  // Add the two non-empty strings.
2388  Push(BuildUncheckedStringAdd(left, right, allocation_mode));
2389  }
2390  if_rightempty.End();
2391  }
2392  if_leftempty.End();
2393 
2394  return Pop();
2395 }
HValue * BuildUncheckedStringAdd(HValue *left, HValue *right, HAllocationMode allocation_mode)
Definition: hydrogen.cc:2180
HInstruction * AddLoadStringLength(HValue *string)
Definition: hydrogen.cc:6807

References v8::internal::EQ, and v8::internal::compiler::Push().

Referenced by BuildBinaryOperation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildTestForDictionaryProperties()

void v8::internal::HGraphBuilder::BuildTestForDictionaryProperties ( HValue object,
HIfContinuation *  continuation 
)
protected

Definition at line 1596 of file hydrogen.cc.

1598  {
1599  HValue* properties = Add<HLoadNamedField>(
1600  object, static_cast<HValue*>(NULL),
1601  HObjectAccess::ForPropertiesPointer());
1602  HValue* properties_map =
1603  Add<HLoadNamedField>(properties, static_cast<HValue*>(NULL),
1604  HObjectAccess::ForMap());
1605  HValue* hash_map = Add<HLoadRoot>(Heap::kHashTableMapRootIndex);
1606  IfBuilder builder(this);
1607  builder.If<HCompareObjectEqAndBranch>(properties_map, hash_map);
1608  builder.CaptureContinuation(continuation);
1609 }

References NULL.

Referenced by v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub().

+ Here is the caller graph for this function:

◆ BuildTransitionElementsKind()

void v8::internal::HGraphBuilder::BuildTransitionElementsKind ( HValue object,
HValue map,
ElementsKind  from_kind,
ElementsKind  to_kind,
bool  is_jsarray 
)
protected

Definition at line 1394 of file hydrogen.cc.

1398  {
1399  DCHECK(!IsFastHoleyElementsKind(from_kind) ||
1400  IsFastHoleyElementsKind(to_kind));
1401 
1402  if (AllocationSite::GetMode(from_kind, to_kind) == TRACK_ALLOCATION_SITE) {
1403  Add<HTrapAllocationMemento>(object);
1404  }
1405 
1406  if (!IsSimpleMapChangeTransition(from_kind, to_kind)) {
1407  HInstruction* elements = AddLoadElements(object);
1408 
1409  HInstruction* empty_fixed_array = Add<HConstant>(
1410  isolate()->factory()->empty_fixed_array());
1411 
1412  IfBuilder if_builder(this);
1413 
1414  if_builder.IfNot<HCompareObjectEqAndBranch>(elements, empty_fixed_array);
1415 
1416  if_builder.Then();
1417 
1418  HInstruction* elements_length = AddLoadFixedArrayLength(elements);
1419 
1420  HInstruction* array_length = is_jsarray
1421  ? Add<HLoadNamedField>(object, static_cast<HValue*>(NULL),
1422  HObjectAccess::ForArrayLength(from_kind))
1423  : elements_length;
1424 
1425  BuildGrowElementsCapacity(object, elements, from_kind, to_kind,
1426  array_length, elements_length);
1427 
1428  if_builder.End();
1429  }
1430 
1431  Add<HStoreNamedField>(object, HObjectAccess::ForMap(), map);
1432 }
static AllocationSiteMode GetMode(ElementsKind boilerplate_elements_kind)
Definition: objects-inl.h:1591
bool IsFastHoleyElementsKind(ElementsKind kind)
bool IsSimpleMapChangeTransition(ElementsKind from_kind, ElementsKind to_kind)

References DCHECK, v8::internal::IsFastHoleyElementsKind(), v8::internal::IsSimpleMapChangeTransition(), map, NULL, and v8::internal::TRACK_ALLOCATION_SITE.

+ Here is the call graph for this function:

◆ BuildUncheckedDictionaryElementLoad()

HValue * v8::internal::HGraphBuilder::BuildUncheckedDictionaryElementLoad ( HValue receiver,
HValue elements,
HValue key,
HValue hash 
)
protected

Definition at line 1667 of file hydrogen.cc.

1670  {
1671  HValue* capacity = Add<HLoadKeyed>(
1672  elements,
1673  Add<HConstant>(NameDictionary::kCapacityIndex),
1674  static_cast<HValue*>(NULL),
1675  FAST_ELEMENTS);
1676 
1677  HValue* mask = AddUncasted<HSub>(capacity, graph()->GetConstant1());
1678  mask->ChangeRepresentation(Representation::Integer32());
1679  mask->ClearFlag(HValue::kCanOverflow);
1680 
1681  HValue* entry = hash;
1682  HValue* count = graph()->GetConstant1();
1683  Push(entry);
1684  Push(count);
1685 
1686  HIfContinuation return_or_loop_continuation(graph()->CreateBasicBlock(),
1687  graph()->CreateBasicBlock());
1688  HIfContinuation found_key_match_continuation(graph()->CreateBasicBlock(),
1689  graph()->CreateBasicBlock());
1690  LoopBuilder probe_loop(this);
1691  probe_loop.BeginBody(2); // Drop entry, count from last environment to
1692  // appease live range building without simulates.
1693 
1694  count = Pop();
1695  entry = Pop();
1696  entry = AddUncasted<HBitwise>(Token::BIT_AND, entry, mask);
1697  int entry_size = SeededNumberDictionary::kEntrySize;
1698  HValue* base_index = AddUncasted<HMul>(entry, Add<HConstant>(entry_size));
1699  base_index->ClearFlag(HValue::kCanOverflow);
1701  HValue* key_index =
1702  AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset));
1703  key_index->ClearFlag(HValue::kCanOverflow);
1704 
1705  HValue* candidate_key = Add<HLoadKeyed>(
1706  elements, key_index, static_cast<HValue*>(NULL), FAST_ELEMENTS);
1707  IfBuilder if_undefined(this);
1708  if_undefined.If<HCompareObjectEqAndBranch>(candidate_key,
1709  graph()->GetConstantUndefined());
1710  if_undefined.Then();
1711  {
1712  // element == undefined means "not found". Call the runtime.
1713  // TODO(jkummerow): walk the prototype chain instead.
1714  Add<HPushArguments>(receiver, key);
1715  Push(Add<HCallRuntime>(isolate()->factory()->empty_string(),
1716  Runtime::FunctionForId(Runtime::kKeyedGetProperty),
1717  2));
1718  }
1719  if_undefined.Else();
1720  {
1721  IfBuilder if_match(this);
1722  if_match.If<HCompareObjectEqAndBranch>(candidate_key, key);
1723  if_match.Then();
1724  if_match.Else();
1725 
1726  // Update non-internalized string in the dictionary with internalized key?
1727  IfBuilder if_update_with_internalized(this);
1728  HValue* smi_check =
1729  if_update_with_internalized.IfNot<HIsSmiAndBranch>(candidate_key);
1730  if_update_with_internalized.And();
1731  HValue* map = AddLoadMap(candidate_key, smi_check);
1732  HValue* instance_type = Add<HLoadNamedField>(
1733  map, static_cast<HValue*>(NULL), HObjectAccess::ForMapInstanceType());
1734  HValue* not_internalized_bit = AddUncasted<HBitwise>(
1735  Token::BIT_AND, instance_type,
1736  Add<HConstant>(static_cast<int>(kIsNotInternalizedMask)));
1737  if_update_with_internalized.If<HCompareNumericAndBranch>(
1738  not_internalized_bit, graph()->GetConstant0(), Token::NE);
1739  if_update_with_internalized.And();
1740  if_update_with_internalized.IfNot<HCompareObjectEqAndBranch>(
1741  candidate_key, graph()->GetConstantHole());
1742  if_update_with_internalized.AndIf<HStringCompareAndBranch>(candidate_key,
1743  key, Token::EQ);
1744  if_update_with_internalized.Then();
1745  // Replace a key that is a non-internalized string by the equivalent
1746  // internalized string for faster further lookups.
1747  Add<HStoreKeyed>(elements, key_index, key, FAST_ELEMENTS);
1748  if_update_with_internalized.Else();
1749 
1750  if_update_with_internalized.JoinContinuation(&found_key_match_continuation);
1751  if_match.JoinContinuation(&found_key_match_continuation);
1752 
1753  IfBuilder found_key_match(this, &found_key_match_continuation);
1754  found_key_match.Then();
1755  // Key at current probe matches. Relevant bits in the |details| field must
1756  // be zero, otherwise the dictionary element requires special handling.
1757  HValue* details_index =
1758  AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 2));
1759  details_index->ClearFlag(HValue::kCanOverflow);
1760  HValue* details = Add<HLoadKeyed>(
1761  elements, details_index, static_cast<HValue*>(NULL), FAST_ELEMENTS);
1762  int details_mask = PropertyDetails::TypeField::kMask |
1763  PropertyDetails::DeletedField::kMask;
1764  details = AddUncasted<HBitwise>(Token::BIT_AND, details,
1765  Add<HConstant>(details_mask));
1766  IfBuilder details_compare(this);
1767  details_compare.If<HCompareNumericAndBranch>(
1768  details, graph()->GetConstant0(), Token::EQ);
1769  details_compare.Then();
1770  HValue* result_index =
1771  AddUncasted<HAdd>(base_index, Add<HConstant>(start_offset + 1));
1772  result_index->ClearFlag(HValue::kCanOverflow);
1773  Push(Add<HLoadKeyed>(elements, result_index, static_cast<HValue*>(NULL),
1774  FAST_ELEMENTS));
1775  details_compare.Else();
1776  Add<HPushArguments>(receiver, key);
1777  Push(Add<HCallRuntime>(isolate()->factory()->empty_string(),
1778  Runtime::FunctionForId(Runtime::kKeyedGetProperty),
1779  2));
1780  details_compare.End();
1781 
1782  found_key_match.Else();
1783  found_key_match.JoinContinuation(&return_or_loop_continuation);
1784  }
1785  if_undefined.JoinContinuation(&return_or_loop_continuation);
1786 
1787  IfBuilder return_or_loop(this, &return_or_loop_continuation);
1788  return_or_loop.Then();
1789  probe_loop.Break();
1790 
1791  return_or_loop.Else();
1792  entry = AddUncasted<HAdd>(entry, count);
1793  entry->ClearFlag(HValue::kCanOverflow);
1794  count = AddUncasted<HAdd>(count, graph()->GetConstant1());
1795  count->ClearFlag(HValue::kCanOverflow);
1796  Push(entry);
1797  Push(count);
1798 
1799  probe_loop.EndBody();
1800 
1801  return_or_loop.End();
1802 
1803  return Pop();
1804 }
static const int kElementsStartIndex
Definition: objects.h:3274
static const int kCapacityIndex
Definition: objects.h:3272
static const int kEntrySize
Definition: objects.h:3276
static Representation Integer32()

References v8::internal::HValue::ChangeRepresentation(), v8::internal::HValue::ClearFlag(), v8::internal::EQ, v8::internal::FAST_ELEMENTS, v8::internal::kIsNotInternalizedMask, map, NULL, and v8::internal::compiler::Push().

Referenced by v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildUncheckedMonomorphicElementAccess()

HInstruction * v8::internal::HGraphBuilder::BuildUncheckedMonomorphicElementAccess ( HValue checked_object,
HValue key,
HValue val,
bool  is_js_array,
ElementsKind  elements_kind,
PropertyAccessType  access_type,
LoadKeyedHoleMode  load_mode,
KeyedAccessStoreMode  store_mode 
)
protected

Definition at line 2398 of file hydrogen.cc.

2406  {
2407  DCHECK((!IsExternalArrayElementsKind(elements_kind) &&
2408  !IsFixedTypedArrayElementsKind(elements_kind)) ||
2409  !is_js_array);
2410  // No GVNFlag is necessary for ElementsKind if there is an explicit dependency
2411  // on a HElementsTransition instruction. The flag can also be removed if the
2412  // map to check has FAST_HOLEY_ELEMENTS, since there can be no further
2413  // ElementsKind transitions. Finally, the dependency can be removed for stores
2414  // for FAST_ELEMENTS, since a transition to HOLEY elements won't change the
2415  // generated store code.
2416  if ((elements_kind == FAST_HOLEY_ELEMENTS) ||
2417  (elements_kind == FAST_ELEMENTS && access_type == STORE)) {
2418  checked_object->ClearDependsOnFlag(kElementsKind);
2419  }
2420 
2421  bool fast_smi_only_elements = IsFastSmiElementsKind(elements_kind);
2422  bool fast_elements = IsFastObjectElementsKind(elements_kind);
2423  HValue* elements = AddLoadElements(checked_object);
2424  if (access_type == STORE && (fast_elements || fast_smi_only_elements) &&
2425  store_mode != STORE_NO_TRANSITION_HANDLE_COW) {
2426  HCheckMaps* check_cow_map = Add<HCheckMaps>(
2427  elements, isolate()->factory()->fixed_array_map());
2428  check_cow_map->ClearDependsOnFlag(kElementsKind);
2429  }
2430  HInstruction* length = NULL;
2431  if (is_js_array) {
2432  length = Add<HLoadNamedField>(
2433  checked_object->ActualValue(), checked_object,
2434  HObjectAccess::ForArrayLength(elements_kind));
2435  } else {
2436  length = AddLoadFixedArrayLength(elements);
2437  }
2438  length->set_type(HType::Smi());
2439  HValue* checked_key = NULL;
2440  if (IsExternalArrayElementsKind(elements_kind) ||
2441  IsFixedTypedArrayElementsKind(elements_kind)) {
2442  HValue* backing_store;
2443  if (IsExternalArrayElementsKind(elements_kind)) {
2444  backing_store = Add<HLoadNamedField>(
2445  elements, static_cast<HValue*>(NULL),
2446  HObjectAccess::ForExternalArrayExternalPointer());
2447  } else {
2448  backing_store = elements;
2449  }
2450  if (store_mode == STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS) {
2451  NoObservableSideEffectsScope no_effects(this);
2452  IfBuilder length_checker(this);
2453  length_checker.If<HCompareNumericAndBranch>(key, length, Token::LT);
2454  length_checker.Then();
2455  IfBuilder negative_checker(this);
2456  HValue* bounds_check = negative_checker.If<HCompareNumericAndBranch>(
2457  key, graph()->GetConstant0(), Token::GTE);
2458  negative_checker.Then();
2459  HInstruction* result = AddElementAccess(
2460  backing_store, key, val, bounds_check, elements_kind, access_type);
2461  negative_checker.ElseDeopt("Negative key encountered");
2462  negative_checker.End();
2463  length_checker.End();
2464  return result;
2465  } else {
2466  DCHECK(store_mode == STANDARD_STORE);
2467  checked_key = Add<HBoundsCheck>(key, length);
2468  return AddElementAccess(
2469  backing_store, checked_key, val,
2470  checked_object, elements_kind, access_type);
2471  }
2472  }
2473  DCHECK(fast_smi_only_elements ||
2474  fast_elements ||
2475  IsFastDoubleElementsKind(elements_kind));
2476 
2477  // In case val is stored into a fast smi array, assure that the value is a smi
2478  // before manipulating the backing store. Otherwise the actual store may
2479  // deopt, leaving the backing store in an invalid state.
2480  if (access_type == STORE && IsFastSmiElementsKind(elements_kind) &&
2481  !val->type().IsSmi()) {
2482  val = AddUncasted<HForceRepresentation>(val, Representation::Smi());
2483  }
2484 
2485  if (IsGrowStoreMode(store_mode)) {
2486  NoObservableSideEffectsScope no_effects(this);
2487  Representation representation = HStoreKeyed::RequiredValueRepresentation(
2488  elements_kind, STORE_TO_INITIALIZED_ENTRY);
2489  val = AddUncasted<HForceRepresentation>(val, representation);
2490  elements = BuildCheckForCapacityGrow(checked_object, elements,
2491  elements_kind, length, key,
2492  is_js_array, access_type);
2493  checked_key = key;
2494  } else {
2495  checked_key = Add<HBoundsCheck>(key, length);
2496 
2497  if (access_type == STORE && (fast_elements || fast_smi_only_elements)) {
2498  if (store_mode == STORE_NO_TRANSITION_HANDLE_COW) {
2499  NoObservableSideEffectsScope no_effects(this);
2500  elements = BuildCopyElementsOnWrite(checked_object, elements,
2501  elements_kind, length);
2502  } else {
2503  HCheckMaps* check_cow_map = Add<HCheckMaps>(
2504  elements, isolate()->factory()->fixed_array_map());
2505  check_cow_map->ClearDependsOnFlag(kElementsKind);
2506  }
2507  }
2508  }
2509  return AddElementAccess(elements, checked_key, val, checked_object,
2510  elements_kind, access_type, load_mode);
2511 }
HValue * BuildCheckForCapacityGrow(HValue *object, HValue *elements, ElementsKind kind, HValue *length, HValue *key, bool is_js_array, PropertyAccessType access_type)
Definition: hydrogen.cc:1302
HInstruction * AddElementAccess(HValue *elements, HValue *checked_key, HValue *val, HValue *dependency, ElementsKind elements_kind, PropertyAccessType access_type, LoadKeyedHoleMode load_mode=NEVER_RETURN_HOLE)
Definition: hydrogen.cc:2671
HValue * BuildCopyElementsOnWrite(HValue *object, HValue *elements, ElementsKind kind, HValue *length)
Definition: hydrogen.cc:1366
bool IsExternalArrayElementsKind(ElementsKind kind)
Definition: elements-kind.h:95
@ STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS
Definition: objects.h:168
@ STORE_NO_TRANSITION_HANDLE_COW
Definition: objects.h:169
@ STANDARD_STORE
Definition: objects.h:154
static bool IsGrowStoreMode(KeyedAccessStoreMode store_mode)
Definition: objects.h:228
bool IsFixedTypedArrayElementsKind(ElementsKind kind)

References v8::internal::HValue::ActualValue(), v8::internal::HValue::ClearDependsOnFlag(), DCHECK, v8::internal::FAST_ELEMENTS, v8::internal::FAST_HOLEY_ELEMENTS, v8::internal::IsExternalArrayElementsKind(), v8::internal::IsFastDoubleElementsKind(), v8::internal::IsFastObjectElementsKind(), v8::internal::IsFastSmiElementsKind(), v8::internal::IsFixedTypedArrayElementsKind(), v8::internal::IsGrowStoreMode(), NULL, v8::internal::HValue::set_type(), v8::internal::STANDARD_STORE, STORE, v8::internal::STORE_NO_TRANSITION_HANDLE_COW, v8::internal::STORE_NO_TRANSITION_IGNORE_OUT_OF_BOUNDS, v8::internal::STORE_TO_INITIALIZED_ENTRY, and v8::internal::HValue::type().

Referenced by v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildExternalElementLoad(), v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildFastElementLoad(), v8::internal::HOptimizedGraphBuilder::BuildMonomorphicElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), v8::internal::HOptimizedGraphBuilder::TryBuildConsolidatedElementLoad(), and v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildUncheckedStringAdd()

HValue * v8::internal::HGraphBuilder::BuildUncheckedStringAdd ( HValue left,
HValue right,
HAllocationMode  allocation_mode 
)
protected

Definition at line 2180 of file hydrogen.cc.

2183  {
2184  // Determine the string lengths.
2185  HValue* left_length = AddLoadStringLength(left);
2186  HValue* right_length = AddLoadStringLength(right);
2187 
2188  // Compute the combined string length.
2189  HValue* length = BuildAddStringLengths(left_length, right_length);
2190 
2191  // Do some manual constant folding here.
2192  if (left_length->IsConstant()) {
2193  HConstant* c_left_length = HConstant::cast(left_length);
2194  DCHECK_NE(0, c_left_length->Integer32Value());
2195  if (c_left_length->Integer32Value() + 1 >= ConsString::kMinLength) {
2196  // The right string contains at least one character.
2197  return BuildCreateConsString(length, left, right, allocation_mode);
2198  }
2199  } else if (right_length->IsConstant()) {
2200  HConstant* c_right_length = HConstant::cast(right_length);
2201  DCHECK_NE(0, c_right_length->Integer32Value());
2202  if (c_right_length->Integer32Value() + 1 >= ConsString::kMinLength) {
2203  // The left string contains at least one character.
2204  return BuildCreateConsString(length, left, right, allocation_mode);
2205  }
2206  }
2207 
2208  // Check if we should create a cons string.
2209  IfBuilder if_createcons(this);
2210  if_createcons.If<HCompareNumericAndBranch>(
2211  length, Add<HConstant>(ConsString::kMinLength), Token::GTE);
2212  if_createcons.Then();
2213  {
2214  // Create a cons string.
2215  Push(BuildCreateConsString(length, left, right, allocation_mode));
2216  }
2217  if_createcons.Else();
2218  {
2219  // Determine the string instance types.
2220  HValue* left_instance_type = AddLoadStringInstanceType(left);
2221  HValue* right_instance_type = AddLoadStringInstanceType(right);
2222 
2223  // Compute union and difference of instance types.
2224  HValue* ored_instance_types = AddUncasted<HBitwise>(
2225  Token::BIT_OR, left_instance_type, right_instance_type);
2226  HValue* xored_instance_types = AddUncasted<HBitwise>(
2227  Token::BIT_XOR, left_instance_type, right_instance_type);
2228 
2229  // Check if both strings have the same encoding and both are
2230  // sequential.
2231  IfBuilder if_sameencodingandsequential(this);
2232  if_sameencodingandsequential.If<HCompareNumericAndBranch>(
2233  AddUncasted<HBitwise>(
2234  Token::BIT_AND, xored_instance_types,
2235  Add<HConstant>(static_cast<int32_t>(kStringEncodingMask))),
2236  graph()->GetConstant0(), Token::EQ);
2237  if_sameencodingandsequential.And();
2239  if_sameencodingandsequential.If<HCompareNumericAndBranch>(
2240  AddUncasted<HBitwise>(
2241  Token::BIT_AND, ored_instance_types,
2242  Add<HConstant>(static_cast<int32_t>(kStringRepresentationMask))),
2243  graph()->GetConstant0(), Token::EQ);
2244  if_sameencodingandsequential.Then();
2245  {
2246  HConstant* string_map =
2247  Add<HConstant>(isolate()->factory()->string_map());
2248  HConstant* one_byte_string_map =
2249  Add<HConstant>(isolate()->factory()->one_byte_string_map());
2250 
2251  // Determine map and size depending on whether result is one-byte string.
2252  IfBuilder if_onebyte(this);
2254  if_onebyte.If<HCompareNumericAndBranch>(
2255  AddUncasted<HBitwise>(
2256  Token::BIT_AND, ored_instance_types,
2257  Add<HConstant>(static_cast<int32_t>(kStringEncodingMask))),
2258  graph()->GetConstant0(), Token::NE);
2259  if_onebyte.Then();
2260  {
2261  // Allocate sequential one-byte string object.
2262  Push(length);
2263  Push(one_byte_string_map);
2264  }
2265  if_onebyte.Else();
2266  {
2267  // Allocate sequential two-byte string object.
2268  HValue* size = AddUncasted<HShl>(length, graph()->GetConstant1());
2269  size->ClearFlag(HValue::kCanOverflow);
2270  size->SetFlag(HValue::kUint32);
2271  Push(size);
2272  Push(string_map);
2273  }
2274  if_onebyte.End();
2275  HValue* map = Pop();
2276 
2277  // Calculate the number of bytes needed for the characters in the
2278  // string while observing object alignment.
2281 
2282  // Allocate the string object. HAllocate does not care whether we pass
2283  // STRING_TYPE or ONE_BYTE_STRING_TYPE here, so we just use STRING_TYPE.
2284  HAllocate* result = BuildAllocate(
2285  size, HType::String(), STRING_TYPE, allocation_mode);
2286  Add<HStoreNamedField>(result, HObjectAccess::ForMap(), map);
2287 
2288  // Initialize the string fields.
2289  Add<HStoreNamedField>(result, HObjectAccess::ForStringHashField(),
2290  Add<HConstant>(String::kEmptyHashField));
2291  Add<HStoreNamedField>(result, HObjectAccess::ForStringLength(), length);
2292 
2293  // Copy characters to the result string.
2294  IfBuilder if_twobyte(this);
2295  if_twobyte.If<HCompareObjectEqAndBranch>(map, string_map);
2296  if_twobyte.Then();
2297  {
2298  // Copy characters from the left string.
2300  left, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
2301  result, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
2302  left_length);
2303 
2304  // Copy characters from the right string.
2306  right, graph()->GetConstant0(), String::TWO_BYTE_ENCODING,
2307  result, left_length, String::TWO_BYTE_ENCODING,
2308  right_length);
2309  }
2310  if_twobyte.Else();
2311  {
2312  // Copy characters from the left string.
2314  left, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
2315  result, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
2316  left_length);
2317 
2318  // Copy characters from the right string.
2320  right, graph()->GetConstant0(), String::ONE_BYTE_ENCODING,
2321  result, left_length, String::ONE_BYTE_ENCODING,
2322  right_length);
2323  }
2324  if_twobyte.End();
2325 
2326  // Count the native string addition.
2327  AddIncrementCounter(isolate()->counters()->string_add_native());
2328 
2329  // Return the sequential string.
2330  Push(result);
2331  }
2332  if_sameencodingandsequential.Else();
2333  {
2334  // Fallback to the runtime to add the two strings.
2335  Add<HPushArguments>(left, right);
2336  Push(Add<HCallRuntime>(
2337  isolate()->factory()->empty_string(),
2338  Runtime::FunctionForId(Runtime::kStringAdd),
2339  2));
2340  }
2341  if_sameencodingandsequential.End();
2342  }
2343  if_createcons.End();
2344 
2345  return Pop();
2346 }
HValue * BuildAddStringLengths(HValue *left_length, HValue *right_length)
Definition: hydrogen.cc:2050
HValue * BuildCreateConsString(HValue *length, HValue *left, HValue *right, HAllocationMode allocation_mode)
Definition: hydrogen.cc:2061
void BuildCopySeqStringChars(HValue *src, HValue *src_offset, String::Encoding src_encoding, HValue *dst, HValue *dst_offset, String::Encoding dst_encoding, HValue *length)
Definition: hydrogen.cc:2145
HValue * BuildObjectSizeAlignment(HValue *unaligned_size, int header_size)
Definition: hydrogen.cc:2167
static const int kHeaderSize
Definition: objects.h:8941
#define DCHECK_NE(v1, v2)
Definition: logging.h:207
@ kSeqStringTag
Definition: objects.h:563
const uint32_t kStringRepresentationMask
Definition: objects.h:561

References DCHECK_NE, v8::internal::EQ, v8::internal::kObjectAlignmentMask, v8::internal::kOneByteStringTag, v8::internal::kSeqStringTag, v8::internal::kStringEncodingMask, v8::internal::kStringRepresentationMask, map, v8::internal::compiler::Push(), size, STATIC_ASSERT, and STRING_TYPE.

+ Here is the call graph for this function:

◆ BuildWrapReceiver()

HValue * v8::internal::HGraphBuilder::BuildWrapReceiver ( HValue object,
HValue function 
)
protected

Definition at line 1289 of file hydrogen.cc.

1289  {
1290  if (object->type().IsJSObject()) return object;
1291  if (function->IsConstant() &&
1292  HConstant::cast(function)->handle(isolate())->IsJSFunction()) {
1293  Handle<JSFunction> f = Handle<JSFunction>::cast(
1294  HConstant::cast(function)->handle(isolate()));
1295  SharedFunctionInfo* shared = f->shared();
1296  if (shared->strict_mode() == STRICT || shared->native()) return object;
1297  }
1298  return Add<HWrapReceiver>(object, function);
1299 }

References v8::internal::handle(), v8::internal::STRICT, v8::internal::SharedFunctionInfo::strict_mode(), and v8::internal::HValue::type().

Referenced by v8::internal::HOptimizedGraphBuilder::TryCallApply().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ context()

virtual HValue* v8::internal::HGraphBuilder::context ( )
pure virtual

Implemented in v8::internal::HOptimizedGraphBuilder, and v8::internal::CodeStubGraphBuilderBase.

Referenced by AddLoadJSBuiltin(), New(), and NewUncasted().

+ Here is the caller graph for this function:

◆ CreateBasicBlock()

HBasicBlock * v8::internal::HGraphBuilder::CreateBasicBlock ( HEnvironment *  env)
protected

Definition at line 1240 of file hydrogen.cc.

1240  {
1241  HBasicBlock* b = graph()->CreateBasicBlock();
1242  b->SetInitialEnvironment(env);
1243  return b;
1244 }

Referenced by Add(), v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub(), v8::internal::CodeStubGraphBuilderBase::BuildGraph(), and v8::internal::HOptimizedGraphBuilder::BuildGraph().

+ Here is the caller graph for this function:

◆ CreateGraph()

HGraph * v8::internal::HGraphBuilder::CreateGraph ( )

Definition at line 1174 of file hydrogen.cc.

1174  {
1175  graph_ = new(zone()) HGraph(info_);
1176  if (FLAG_hydrogen_stats) isolate()->GetHStatistics()->Initialize(info_);
1177  CompilationPhase phase("H_Block building", info_);
1178  set_current_block(graph()->entry_block());
1179  if (!BuildGraph()) return NULL;
1180  graph()->FinalizeUniqueness();
1181  return graph_;
1182 }
virtual bool BuildGraph()=0
HStatistics * GetHStatistics()
Definition: isolate.cc:2136

References NULL.

Referenced by v8::internal::OptimizedCompileJob::CreateGraph(), and v8::internal::DoGenerateCode().

+ Here is the caller graph for this function:

◆ CreateLoopHeaderBlock()

HBasicBlock * v8::internal::HGraphBuilder::CreateLoopHeaderBlock ( )
protected

Definition at line 1247 of file hydrogen.cc.

1247  {
1248  HBasicBlock* header = graph()->CreateBasicBlock();
1249  HEnvironment* entry_env = environment()->CopyAsLoopHeader(header);
1250  header->SetInitialEnvironment(entry_env);
1251  header->AttachLoopInformation();
1252  return header;
1253 }

Referenced by v8::internal::HOptimizedGraphBuilder::BuildLoopEntry().

+ Here is the caller graph for this function:

◆ current_block()

◆ EnforceNumberType()

HValue * v8::internal::HGraphBuilder::EnforceNumberType ( HValue number,
Type expected 
)
protected

Definition at line 10171 of file hydrogen.cc.

10172  {
10173  if (expected->Is(Type::SignedSmall())) {
10174  return AddUncasted<HForceRepresentation>(number, Representation::Smi());
10175  }
10176  if (expected->Is(Type::Signed32())) {
10177  return AddUncasted<HForceRepresentation>(number,
10179  }
10180  return number;
10181 }

References v8::internal::Representation::Integer32(), v8::internal::TypeImpl< Config >::Is(), and v8::internal::Representation::Smi().

Referenced by BuildBinaryOperation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ EnterInlinedSource()

void v8::internal::HGraphBuilder::EnterInlinedSource ( int  start_position,
int  id 
)
inlineprotected

Definition at line 1887 of file hydrogen.h.

1887  {
1888  if (FLAG_hydrogen_track_positions) {
1889  start_position_ = start_position;
1891  }
1892  }
void set_inlining_id(int inlining_id)

References position_, v8::internal::HSourcePosition::set_inlining_id(), and start_position_.

+ Here is the call graph for this function:

◆ environment()

◆ EstablishElementsAllocationSize()

HConstant * v8::internal::HGraphBuilder::EstablishElementsAllocationSize ( ElementsKind  kind,
int  capacity 
)
protected

Definition at line 2593 of file hydrogen.cc.

2595  {
2596  int base_size = IsFastDoubleElementsKind(kind)
2597  ? FixedDoubleArray::SizeFor(capacity)
2598  : FixedArray::SizeFor(capacity);
2599 
2600  return Add<HConstant>(base_size);
2601 }
static int SizeFor(int length)
Definition: objects.h:2531

References v8::internal::IsFastDoubleElementsKind().

+ Here is the call graph for this function:

◆ FinishCurrentBlock()

void v8::internal::HGraphBuilder::FinishCurrentBlock ( HControlInstruction last)

Definition at line 1198 of file hydrogen.cc.

1198  {
1199  DCHECK(!FLAG_hydrogen_track_positions ||
1200  !info_->IsOptimizing() ||
1201  !position_.IsUnknown());
1202  current_block()->Finish(last, source_position());
1203  if (last->IsReturn() || last->IsAbnormalExit()) {
1205  }
1206 }

References DCHECK, and NULL.

Referenced by Add(), v8::internal::CodeStubGraphBuilderBase::BuildGraph(), v8::internal::HOsrBuilder::BuildOsrLoopEntry(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(), and v8::internal::HOptimizedGraphBuilder::VisitLogicalExpression().

+ Here is the caller graph for this function:

◆ FinishExitCurrentBlock()

void v8::internal::HGraphBuilder::FinishExitCurrentBlock ( HControlInstruction instruction)

Definition at line 1209 of file hydrogen.cc.

1209  {
1210  DCHECK(!FLAG_hydrogen_track_positions || !info_->IsOptimizing() ||
1211  !position_.IsUnknown());
1212  current_block()->FinishExit(instruction, source_position());
1213  if (instruction->IsReturn() || instruction->IsAbnormalExit()) {
1215  }
1216 }

References DCHECK, and NULL.

Referenced by Add().

+ Here is the caller graph for this function:

◆ FinishExitWithHardDeoptimization()

void v8::internal::HGraphBuilder::FinishExitWithHardDeoptimization ( const char *  reason)
protected

Definition at line 1272 of file hydrogen.cc.

1272  {
1273  Add<HDeoptimize>(reason, Deoptimizer::EAGER);
1274  FinishExitCurrentBlock(New<HAbnormalExit>());
1275 }

Referenced by v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), and v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess().

+ Here is the caller graph for this function:

◆ Goto() [1/2]

void v8::internal::HGraphBuilder::Goto ( HBasicBlock *  from,
HBasicBlock *  target,
FunctionState *  state = NULL,
bool  add_simulate = true 
)
inline

Definition at line 1080 of file hydrogen.h.

1083  {
1084  from->Goto(target, source_position(), state, add_simulate);
1085  }

References source_position().

Referenced by v8::internal::CodeStubGraphBuilderBase::BuildGraph(), v8::internal::HOptimizedGraphBuilder::BuildGraph(), v8::internal::HOptimizedGraphBuilder::BuildLoopEntry(), v8::internal::HOsrBuilder::BuildOsrLoopEntry(), v8::internal::HOptimizedGraphBuilder::CreateJoin(), v8::internal::HOptimizedGraphBuilder::CreateLoop(), Goto(), GotoNoSimulate(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(), v8::internal::HOptimizedGraphBuilder::JoinContinue(), and v8::internal::HOptimizedGraphBuilder::TryInline().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Goto() [2/2]

void v8::internal::HGraphBuilder::Goto ( HBasicBlock *  target,
FunctionState *  state = NULL,
bool  add_simulate = true 
)
inline

Definition at line 1086 of file hydrogen.h.

1088  {
1089  Goto(current_block(), target, state, add_simulate);
1090  }
void Goto(HBasicBlock *from, HBasicBlock *target, FunctionState *state=NULL, bool add_simulate=true)
Definition: hydrogen.h:1080

References current_block(), and Goto().

+ Here is the call graph for this function:

◆ GotoNoSimulate() [1/2]

void v8::internal::HGraphBuilder::GotoNoSimulate ( HBasicBlock *  from,
HBasicBlock *  target 
)
inline

Definition at line 1091 of file hydrogen.h.

1091  {
1092  Goto(from, target, NULL, false);
1093  }

References Goto(), and NULL.

Referenced by v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), and v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GotoNoSimulate() [2/2]

void v8::internal::HGraphBuilder::GotoNoSimulate ( HBasicBlock *  target)
inline

Definition at line 1094 of file hydrogen.h.

1094  {
1095  Goto(target, NULL, false);
1096  }

References Goto(), and NULL.

+ Here is the call graph for this function:

◆ graph()

HGraph* v8::internal::HGraphBuilder::graph ( ) const
inline

Definition at line 1063 of file hydrogen.h.

1063 { return graph_; }

References graph_.

Referenced by Add(), BuildArrayBufferViewInitialization(), v8::internal::HOptimizedGraphBuilder::BuildArrayIndexOf(), v8::internal::CodeStubGraphBuilderBase::BuildArrayNArgumentsConstructor(), v8::internal::CodeStubGraphBuilderBase::BuildArraySingleArgumentConstructor(), BuildBinaryOperation(), v8::internal::HOptimizedGraphBuilder::BuildCallConstantFunction(), v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub(), v8::internal::CodeStubGraphBuilder< Stub >::BuildCodeUninitializedStub(), v8::internal::HOptimizedGraphBuilder::BuildCompareInstruction(), v8::internal::HOptimizedGraphBuilder::BuildEmitInObjectProperties(), v8::internal::CodeStubGraphBuilderBase::BuildGraph(), v8::internal::HOptimizedGraphBuilder::BuildGraph(), v8::internal::HOptimizedGraphBuilder::BuildIncrement(), v8::internal::CodeStubGraphBuilderBase::BuildInstallCode(), v8::internal::HOptimizedGraphBuilder::BuildKeyedHoleMode(), v8::internal::HOptimizedGraphBuilder::BuildMonomorphicAccess(), v8::internal::HOsrBuilder::BuildOsrLoopEntry(), v8::internal::HOptimizedGraphBuilder::CreateJoin(), v8::internal::HOptimizedGraphBuilder::HandleLiteralCompareNil(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(), v8::internal::HOptimizedGraphBuilder::ImplicitReceiverFor(), v8::internal::HOptimizedGraphBuilder::SetUpScope(), v8::internal::HOptimizedGraphBuilder::TryArgumentsAccess(), v8::internal::HOptimizedGraphBuilder::TryInline(), v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(), v8::internal::CodeStubGraphBuilderBase::UnmappedCase(), v8::internal::HOptimizedGraphBuilder::VisitDelete(), v8::internal::HOptimizedGraphBuilder::VisitLogicalExpression(), v8::internal::HOptimizedGraphBuilder::VisitNot(), and v8::internal::HOptimizedGraphBuilder::VisitVoid().

+ Here is the caller graph for this function:

◆ isolate()

Isolate* v8::internal::HGraphBuilder::isolate ( ) const
inline

Definition at line 1064 of file hydrogen.h.

1064 { return graph_->isolate(); }

References graph_.

Referenced by Add(), v8::internal::HOptimizedGraphBuilder::array_function(), v8::internal::HOptimizedGraphBuilder::BuildAllocateExternalElements(), v8::internal::HOptimizedGraphBuilder::BuildAllocateFixedTypedArray(), v8::internal::HOptimizedGraphBuilder::BuildArrayIndexOf(), BuildCheckPrototypeMaps(), v8::internal::HOptimizedGraphBuilder::BuildEmitFixedArray(), v8::internal::HOptimizedGraphBuilder::BuildEmitInObjectProperties(), v8::internal::HOptimizedGraphBuilder::BuildEmitObjectHeader(), v8::internal::HOptimizedGraphBuilder::BuildFastLiteral(), v8::internal::HOptimizedGraphBuilder::BuildInitElementsInObjectHeader(), v8::internal::HOptimizedGraphBuilder::BuildKeyedGeneric(), v8::internal::HOptimizedGraphBuilder::BuildKeyedHoleMode(), v8::internal::HOptimizedGraphBuilder::BuildLoadNamedField(), v8::internal::HOptimizedGraphBuilder::BuildMonomorphicAccess(), v8::internal::HOptimizedGraphBuilder::BuildNamedGeneric(), v8::internal::HOptimizedGraphBuilder::BuildStoreNamedField(), v8::internal::HOptimizedGraphBuilder::PropertyAccessInfo::CanAccessMonomorphic(), v8::internal::HOptimizedGraphBuilder::HandleGlobalVariableAssignment(), v8::internal::HOptimizedGraphBuilder::HandleKeyedElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(), v8::internal::HOptimizedGraphBuilder::ImplicitReceiverFor(), v8::internal::IsLiteralCompareBool(), v8::internal::HOptimizedGraphBuilder::NewArgumentAdaptorCall(), v8::internal::HOptimizedGraphBuilder::TryArgumentsAccess(), v8::internal::HOptimizedGraphBuilder::TryCallApply(), v8::internal::HOptimizedGraphBuilder::TryInlineApiCall(), v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(), v8::internal::TypedArrayMap(), and v8::internal::HOptimizedGraphBuilder::VisitDeclarations().

+ Here is the caller graph for this function:

◆ MatchRotateRight()

bool v8::internal::HGraphBuilder::MatchRotateRight ( HValue left,
HValue right,
HValue **  operand,
HValue **  shift_amount 
)
protected

Definition at line 10132 of file hydrogen.cc.

10135  {
10136  HShl* shl;
10137  HShr* shr;
10138  if (left->IsShl() && right->IsShr()) {
10139  shl = HShl::cast(left);
10140  shr = HShr::cast(right);
10141  } else if (left->IsShr() && right->IsShl()) {
10142  shl = HShl::cast(right);
10143  shr = HShr::cast(left);
10144  } else {
10145  return false;
10146  }
10147  if (shl->left() != shr->left()) return false;
10148 
10149  if (!ShiftAmountsAllowReplaceByRotate(shl->right(), shr->right()) &&
10150  !ShiftAmountsAllowReplaceByRotate(shr->right(), shl->right())) {
10151  return false;
10152  }
10153  *operand= shr->left();
10154  *shift_amount = shr->right();
10155  return true;
10156 }
static bool ShiftAmountsAllowReplaceByRotate(HValue *sa, HValue *const32_minus_sa)
Definition: hydrogen.cc:10114

References v8::internal::ShiftAmountsAllowReplaceByRotate().

Referenced by BuildBinaryOperation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ New() [1/10]

template<class I >
I* v8::internal::HGraphBuilder::New ( )
inline

Definition at line 1110 of file hydrogen.h.

1110 { return I::New(zone(), context()); }

References context(), and zone().

Referenced by v8::internal::HOsrBuilder::BuildOsrLoopEntry().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ New() [2/10]

template<>
HContext* v8::internal::HGraphBuilder::New ( )
inline

Definition at line 2035 of file hydrogen.h.

2035  {
2036  return HContext::New(zone());
2037 }

References zone().

+ Here is the call graph for this function:

◆ New() [3/10]

template<class I , class P1 >
I* v8::internal::HGraphBuilder::New ( P1  p1)
inline

Definition at line 1124 of file hydrogen.h.

1124 { return I::New(zone(), context(), p1); }

References context(), v8::internal::p1, and zone().

+ Here is the call graph for this function:

◆ New() [4/10]

template<class I , class P1 , class P2 >
I* v8::internal::HGraphBuilder::New ( P1  p1,
P2  p2 
)
inline

Definition at line 1152 of file hydrogen.h.

1152  {
1153  return I::New(zone(), context(), p1, p2);
1154  }

References context(), v8::internal::p1, v8::internal::p2, and zone().

+ Here is the call graph for this function:

◆ New() [5/10]

template<class I , class P1 , class P2 , class P3 >
I* v8::internal::HGraphBuilder::New ( P1  p1,
P2  p2,
P3  p3 
)
inline

Definition at line 1180 of file hydrogen.h.

1180  {
1181  return I::New(zone(), context(), p1, p2, p3);
1182  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, and zone().

+ Here is the call graph for this function:

◆ New() [6/10]

template<class I , class P1 , class P2 , class P3 , class P4 >
I* v8::internal::HGraphBuilder::New ( P1  p1,
P2  p2,
P3  p3,
P4  p4 
)
inline

Definition at line 1200 of file hydrogen.h.

1200  {
1201  return I::New(zone(), context(), p1, p2, p3, p4);
1202  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, and zone().

+ Here is the call graph for this function:

◆ New() [7/10]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 >
I* v8::internal::HGraphBuilder::New ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
)
inline

Definition at line 1220 of file hydrogen.h.

1220  {
1221  return I::New(zone(), context(), p1, p2, p3, p4, p5);
1222  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, and zone().

+ Here is the call graph for this function:

◆ New() [8/10]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
I* v8::internal::HGraphBuilder::New ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6 
)
inline

Definition at line 1240 of file hydrogen.h.

1240  {
1241  return I::New(zone(), context(), p1, p2, p3, p4, p5, p6);
1242  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, and zone().

+ Here is the call graph for this function:

◆ New() [9/10]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
I* v8::internal::HGraphBuilder::New ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7 
)
inline

Definition at line 1262 of file hydrogen.h.

1262  {
1263  return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7);
1264  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, v8::internal::p7, and zone().

+ Here is the call graph for this function:

◆ New() [10/10]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
I* v8::internal::HGraphBuilder::New ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7,
P8  p8 
)
inline

Definition at line 1287 of file hydrogen.h.

1287  {
1288  return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7, p8);
1289  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, v8::internal::p7, v8::internal::p8, and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [1/10]

template<class I >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( )
inline

Definition at line 1107 of file hydrogen.h.

1107 { return I::New(zone(), context()); }

References context(), and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [2/10]

template<>
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( )
inline

Definition at line 2041 of file hydrogen.h.

2041  {
2042  return New<HContext>();
2043 }

◆ NewUncasted() [3/10]

template<class I , class P1 >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( P1  p1)
inline

Definition at line 1119 of file hydrogen.h.

1119  {
1120  return I::New(zone(), context(), p1);
1121  }

References context(), v8::internal::p1, and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [4/10]

template<class I , class P1 , class P2 >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( P1  p1,
P2  p2 
)
inline

Definition at line 1147 of file hydrogen.h.

1147  {
1148  return I::New(zone(), context(), p1, p2);
1149  }

References context(), v8::internal::p1, v8::internal::p2, and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [5/10]

template<class I , class P1 , class P2 , class P3 >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( P1  p1,
P2  p2,
P3  p3 
)
inline

Definition at line 1175 of file hydrogen.h.

1175  {
1176  return I::New(zone(), context(), p1, p2, p3);
1177  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [6/10]

template<class I , class P1 , class P2 , class P3 , class P4 >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4 
)
inline

Definition at line 1195 of file hydrogen.h.

1195  {
1196  return I::New(zone(), context(), p1, p2, p3, p4);
1197  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [7/10]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5 
)
inline

Definition at line 1215 of file hydrogen.h.

1215  {
1216  return I::New(zone(), context(), p1, p2, p3, p4, p5);
1217  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [8/10]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6 
)
inline

Definition at line 1235 of file hydrogen.h.

1235  {
1236  return I::New(zone(), context(), p1, p2, p3, p4, p5, p6);
1237  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [9/10]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7 
)
inline

Definition at line 1256 of file hydrogen.h.

1256  {
1257  return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7);
1258  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, v8::internal::p7, and zone().

+ Here is the call graph for this function:

◆ NewUncasted() [10/10]

template<class I , class P1 , class P2 , class P3 , class P4 , class P5 , class P6 , class P7 , class P8 >
HInstruction* v8::internal::HGraphBuilder::NewUncasted ( P1  p1,
P2  p2,
P3  p3,
P4  p4,
P5  p5,
P6  p6,
P7  p7,
P8  p8 
)
inline

Definition at line 1280 of file hydrogen.h.

1281  {
1282  return I::New(zone(), context(), p1, p2, p3, p4, p5, p6, p7, p8);
1283  }

References context(), v8::internal::p1, v8::internal::p2, v8::internal::p3, v8::internal::p4, v8::internal::p5, v8::internal::p6, v8::internal::p7, v8::internal::p8, and zone().

+ Here is the call graph for this function:

◆ Pop()

HValue* v8::internal::HGraphBuilder::Pop ( )
inline

Definition at line 1071 of file hydrogen.h.

1071 { return environment()->Pop(); }

References environment().

Referenced by v8::internal::HOptimizedGraphBuilder::BuildArrayIndexOf(), v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub(), v8::internal::HOptimizedGraphBuilder::BuildIncrement(), v8::internal::HOptimizedGraphBuilder::BuildLoad(), v8::internal::HOptimizedGraphBuilder::BuildStore(), v8::internal::HOptimizedGraphBuilder::HandleCompoundAssignment(), v8::internal::HOptimizedGraphBuilder::HandleLiteralCompareNil(), v8::internal::HOptimizedGraphBuilder::HandleLiteralCompareTypeof(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(), v8::internal::HOptimizedGraphBuilder::PushArgumentsFromEnvironment(), v8::internal::HOptimizedGraphBuilder::TryArgumentsAccess(), v8::internal::HOptimizedGraphBuilder::TryCallApply(), v8::internal::HOptimizedGraphBuilder::TryInlineApiCall(), v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(), v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(), v8::internal::HOptimizedGraphBuilder::VisitArithmeticExpression(), v8::internal::HOptimizedGraphBuilder::VisitDelete(), v8::internal::HOptimizedGraphBuilder::VisitLogicalExpression(), v8::internal::HOptimizedGraphBuilder::VisitNot(), and v8::internal::HOptimizedGraphBuilder::VisitTypeof().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Push()

void v8::internal::HGraphBuilder::Push ( HValue value)
inline

Definition at line 1070 of file hydrogen.h.

1070 { environment()->Push(value); }

References environment().

Referenced by v8::internal::HOptimizedGraphBuilder::BuildArrayIndexOf(), v8::internal::HOptimizedGraphBuilder::BuildBinaryOperation(), v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildCodeStub(), v8::internal::HOptimizedGraphBuilder::BuildCompareInstruction(), v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildExternalElementLoad(), v8::internal::CodeStubGraphBuilder< KeyedLoadGenericStub >::BuildFastElementLoad(), v8::internal::HOptimizedGraphBuilder::BuildIncrement(), v8::internal::HOptimizedGraphBuilder::BuildLoad(), v8::internal::HOptimizedGraphBuilder::BuildMonomorphicAccess(), v8::internal::HOptimizedGraphBuilder::BuildStore(), v8::internal::HOptimizedGraphBuilder::BuildStoreForEffect(), v8::internal::HOptimizedGraphBuilder::HandleCompoundAssignment(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicCallNamed(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicElementAccess(), v8::internal::HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(), v8::internal::HOptimizedGraphBuilder::PushLoad(), v8::internal::HOptimizedGraphBuilder::TryArgumentsAccess(), v8::internal::HOptimizedGraphBuilder::TryCallApply(), v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(), and v8::internal::HOptimizedGraphBuilder::VisitNot().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ scope()

◆ ScriptPositionToSourcePosition()

HSourcePosition v8::internal::HGraphBuilder::ScriptPositionToSourcePosition ( int  position)
inlineprotected

Definition at line 1897 of file hydrogen.h.

1897  {
1898  HSourcePosition pos = position_;
1899  pos.set_position(position - start_position_);
1900  return pos;
1901  }

References position_, v8::internal::HSourcePosition::set_position(), and start_position_.

Referenced by v8::internal::HOptimizedGraphBuilder::TryInlineApply(), v8::internal::HOptimizedGraphBuilder::TryInlineCall(), v8::internal::HOptimizedGraphBuilder::TryInlineConstruct(), and v8::internal::HOptimizedGraphBuilder::VisitArithmeticExpression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_current_block()

◆ set_scope()

void v8::internal::HGraphBuilder::set_scope ( Scope scope)
inline

Definition at line 1055 of file hydrogen.h.

1055 { scope_ = scope; }

References scope(), and scope_.

Referenced by v8::internal::HOptimizedGraphBuilder::TryInline().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ set_source_position()

void v8::internal::HGraphBuilder::set_source_position ( HSourcePosition  position)
inlineprotected

Definition at line 1904 of file hydrogen.h.

1904  {
1905  position_ = position;
1906  }

References position_.

◆ SetSourcePosition()

void v8::internal::HGraphBuilder::SetSourcePosition ( int  position)
inlineprotected

Definition at line 1882 of file hydrogen.h.

1882  {
1883  DCHECK(position != RelocInfo::kNoPosition);
1885  }
static const int kNoPosition
Definition: assembler.h:317

References DCHECK, v8::internal::RelocInfo::kNoPosition, position_, v8::internal::HSourcePosition::set_position(), and start_position_.

Referenced by v8::internal::HOptimizedGraphBuilder::HandleLiteralCompareNil(), v8::internal::HOptimizedGraphBuilder::HandleLiteralCompareTypeof(), v8::internal::HOptimizedGraphBuilder::HOptimizedGraphBuilder(), and v8::internal::HOptimizedGraphBuilder::VisitArithmeticExpression().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ source_position()

HSourcePosition v8::internal::HGraphBuilder::source_position ( )
inlineprotected

Definition at line 1903 of file hydrogen.h.

1903 { return position_; }

References position_.

Referenced by AddLeaveInlined(), Goto(), v8::internal::HOptimizedGraphBuilder::TryInlineGetter(), and v8::internal::HOptimizedGraphBuilder::TryInlineSetter().

+ Here is the caller graph for this function:

◆ top_info()

CompilationInfo* v8::internal::HGraphBuilder::top_info ( )
inline

Definition at line 1065 of file hydrogen.h.

1065 { return info_; }

References info_.

Referenced by BuildBinaryOperation(), v8::internal::HOptimizedGraphBuilder::BuildFastLiteral(), v8::internal::HOptimizedGraphBuilder::BuildInlinedCallArray(), v8::internal::HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMaps(), v8::internal::HOptimizedGraphBuilder::PropertyAccessInfo::top_info(), and v8::internal::HOptimizedGraphBuilder::TryInline().

+ Here is the caller graph for this function:

◆ TruncateToNumber()

HValue * v8::internal::HGraphBuilder::TruncateToNumber ( HValue value,
Type **  expected 
)
protected

Definition at line 10184 of file hydrogen.cc.

10184  {
10185  if (value->IsConstant()) {
10186  HConstant* constant = HConstant::cast(value);
10187  Maybe<HConstant*> number = constant->CopyToTruncatedNumber(zone());
10188  if (number.has_value) {
10189  *expected = Type::Number(zone());
10190  return AddInstruction(number.value);
10191  }
10192  }
10193 
10194  // We put temporary values on the stack, which don't correspond to anything
10195  // in baseline code. Since nothing is observable we avoid recording those
10196  // pushes with a NoObservableSideEffectsScope.
10197  NoObservableSideEffectsScope no_effects(this);
10198 
10199  Type* expected_type = *expected;
10200 
10201  // Separate the number type from the rest.
10202  Type* expected_obj =
10203  Type::Intersect(expected_type, Type::NonNumber(zone()), zone());
10204  Type* expected_number =
10205  Type::Intersect(expected_type, Type::Number(zone()), zone());
10206 
10207  // We expect to get a number.
10208  // (We need to check first, since Type::None->Is(Type::Any()) == true.
10209  if (expected_obj->Is(Type::None())) {
10210  DCHECK(!expected_number->Is(Type::None(zone())));
10211  return value;
10212  }
10213 
10214  if (expected_obj->Is(Type::Undefined(zone()))) {
10215  // This is already done by HChange.
10216  *expected = Type::Union(expected_number, Type::Number(zone()), zone());
10217  return value;
10218  }
10219 
10220  return value;
10221 }
static TypeHandle Intersect(TypeHandle type1, TypeHandle type2, Region *reg)
Definition: types.cc:607
static TypeHandle Union(TypeHandle type1, TypeHandle type2, Region *reg)
Definition: types.cc:737
TypeImpl< ZoneTypeConfig > Type
@ None
Definition: v8.h:2211

References AddInstruction(), DCHECK, v8::Maybe< T >::has_value, v8::internal::TypeImpl< ZoneTypeConfig >::Intersect(), v8::internal::TypeImpl< Config >::Is(), v8::None, v8::Undefined(), v8::internal::TypeImpl< ZoneTypeConfig >::Union(), v8::Maybe< T >::value, and zone().

Referenced by BuildBinaryOperation().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ zone()

Zone* v8::internal::HGraphBuilder::zone ( ) const
inline

Definition at line 1062 of file hydrogen.h.

1062 { return info_->zone(); }

References info_, and v8::internal::CompilationInfo::zone().

Referenced by BuildBinaryOperation(), v8::internal::HOptimizedGraphBuilder::BuildCompareInstruction(), v8::internal::HOptimizedGraphBuilder::BuildLoadNamedField(), v8::internal::HOptimizedGraphBuilder::BuildNamedAccess(), v8::internal::HOsrBuilder::BuildOsrLoopEntry(), v8::internal::ComputeReceiverTypes(), v8::internal::HOptimizedGraphBuilder::HandleKeyedElementAccess(), v8::internal::HOptimizedGraphBuilder::HandleLiteralCompareNil(), v8::internal::HOptimizedGraphBuilder::PropertyAccessInfo::LoadFieldMaps(), New(), NewUncasted(), v8::internal::HOptimizedGraphBuilder::operator new(), v8::internal::HOptimizedGraphBuilder::PushArgumentsFromEnvironment(), v8::internal::HOptimizedGraphBuilder::SetUpScope(), v8::internal::HOptimizedGraphBuilder::ToType(), TruncateToNumber(), v8::internal::HOptimizedGraphBuilder::TryInline(), v8::internal::HOptimizedGraphBuilder::TryInlineApiCall(), v8::internal::HOptimizedGraphBuilder::TryInlineApiGetter(), v8::internal::HOptimizedGraphBuilder::TryInlineApiSetter(), v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinFunctionCall(), v8::internal::HOptimizedGraphBuilder::TryInlineBuiltinMethodCall(), v8::internal::HOptimizedGraphBuilder::VisitArithmeticExpression(), v8::internal::HOptimizedGraphBuilder::PropertyAccessInfo::zone(), and v8::internal::AstContext::zone().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Member Data Documentation

◆ current_block_

HBasicBlock* v8::internal::HGraphBuilder::current_block_
private

Definition at line 1924 of file hydrogen.h.

Referenced by current_block(), and set_current_block().

◆ graph_

HGraph* v8::internal::HGraphBuilder::graph_
private

Definition at line 1923 of file hydrogen.h.

Referenced by graph(), and isolate().

◆ info_

CompilationInfo* v8::internal::HGraphBuilder::info_
private

◆ kElementLoopUnrollThreshold

const int v8::internal::HGraphBuilder::kElementLoopUnrollThreshold = 8
static

◆ position_

HSourcePosition v8::internal::HGraphBuilder::position_
private

◆ scope_

Scope* v8::internal::HGraphBuilder::scope_
private

◆ start_position_

int v8::internal::HGraphBuilder::start_position_
private

The documentation for this class was generated from the following files: