42 using namespace v8::internal;
53 ASSERT(
string.length() > 0);
54 #if V8_TARGET_ARCH_IA32
57 __ mov(
eax, Immediate(0));
58 __ mov(
ebx, Immediate(
string.at(0)));
60 for (
int i = 1; i <
string.length(); i++) {
61 __ mov(
ebx, Immediate(
string.at(i)));
68 #elif V8_TARGET_ARCH_X64
70 __ InitializeRootRegister();
73 __ movp(
rax, Immediate(0));
74 __ movp(
rbx, Immediate(
string.at(0)));
76 for (
int i = 1; i <
string.length(); i++) {
77 __ movp(
rbx, Immediate(
string.at(i)));
85 #elif V8_TARGET_ARCH_ARM
87 __ InitializeRootRegister();
92 for (
int i = 1; i <
string.length(); i++) {
99 #elif V8_TARGET_ARCH_ARM64
102 Register old_stack_pointer =
__ StackPointer();
103 __ SetStackPointer(csp);
105 __ InitializeRootRegister();
109 for (
int i = 1; i <
string.length(); i++) {
116 __ SetStackPointer(old_stack_pointer);
117 #elif V8_TARGET_ARCH_MIPS
119 __ InitializeRootRegister();
124 for (
int i = 1; i <
string.length(); i++) {
133 #error Unsupported architecture.
139 #if V8_TARGET_ARCH_IA32
141 __ mov(
eax, Immediate(key));
145 #elif V8_TARGET_ARCH_X64
147 __ InitializeRootRegister();
149 __ movp(
rax, Immediate(key));
154 #elif V8_TARGET_ARCH_ARM
156 __ InitializeRootRegister();
161 #elif V8_TARGET_ARCH_ARM64
164 Register old_stack_pointer =
__ StackPointer();
165 __ SetStackPointer(csp);
167 __ InitializeRootRegister();
169 __ GetNumberHash(x0, x10);
172 __ SetStackPointer(old_stack_pointer);
173 #elif V8_TARGET_ARCH_MIPS
175 __ InitializeRootRegister();
177 __ GetNumberHash(v0, t1);
182 #error Unsupported architecture.
203 CHECK(code->IsCode());
205 HASH_FUNCTION hash = FUNCTION_CAST<HASH_FUNCTION>(code->entry());
209 uint32_t codegen_hash =
static_cast<uint32_t
>(
212 uint32_t codegen_hash = hash();
214 uint32_t runtime_hash = v8_string->Hash();
215 CHECK(runtime_hash == codegen_hash);
240 CHECK(code->IsCode());
242 HASH_FUNCTION hash = FUNCTION_CAST<HASH_FUNCTION>(code->entry());
244 uint32_t codegen_hash =
static_cast<uint32_t
>(
247 uint32_t codegen_hash = hash();
251 CHECK(runtime_hash == codegen_hash);
256 uint8_t ab[2] = {a, b};
261 static uint32_t PseudoRandom(uint32_t i, uint32_t j) {
262 return ~(~((i * 781) ^ (j * 329)));
273 if (a >=
'0' && a <=
'9')
continue;
275 if (b >=
'0' && b <=
'9')
continue;
293 for (uint32_t key = 0; key < 42; key += 7) {
298 static const uint32_t kLimit = 1000;
299 for (uint32_t i = 0; i < 5; i++) {
300 for (uint32_t j = 0; j < 5; j++) {
301 check(PseudoRandom(i, j) % kLimit);
Handle< String > NewStringFromOneByte(Vector< const uint8_t > str, PretenureFlag pretenure=NOT_TENURED)
static void GenerateHashGetHash(MacroAssembler *masm, Register hash)
uint32_t(* HASH_FUNCTION)()
#define ASSERT(condition)
void check_twochars(uint8_t a, uint8_t b)
const Register kRootRegister
void GetCode(CodeDesc *desc)
void check(i::Vector< const uint8_t > string)
enable upcoming ES6 features enable harmony block scoping enable harmony enable harmony proxies enable harmony generators enable harmony numeric enable harmony string enable harmony math functions harmony_scoping harmony_symbols harmony_collections harmony_iteration harmony_strings harmony_scoping harmony_maths tracks arrays with only smi values Optimize object Array DOM strings and string pretenure call new trace pretenuring decisions of HAllocate instructions track fields with only smi values track fields with heap values track_fields track_fields Enables optimizations which favor memory size over execution speed use string slices optimization filter maximum number of GVN fix point iterations use function inlining use allocation folding eliminate write barriers targeting allocations in optimized code maximum source size in bytes considered for a single inlining maximum cumulative number of AST nodes considered for inlining crankshaft harvests type feedback from stub cache trace check elimination phase hydrogen tracing filter trace hydrogen to given file name trace inlining decisions trace store elimination trace all use positions trace global value numbering trace hydrogen escape analysis trace the tracking of allocation sites trace map generalization environment for every instruction deoptimize every n garbage collections put a break point before deoptimizing deoptimize uncommon cases use on stack replacement trace array bounds check elimination perform array index dehoisting use load elimination use store elimination use constant folding eliminate unreachable code number of stress runs when picking a function to watch for shared function not JSFunction itself flushes the cache of optimized code for closures on every GC functions with arguments object maximum number of escape analysis fix point iterations allow uint32 values on optimize frames if they are used only in safe operations track concurrent recompilation artificial compilation delay in ms concurrent on stack replacement do not emit check maps for constant values that have a leaf deoptimize the optimized code if the layout of the maps changes number of stack frames inspected by the profiler percentage of ICs that must have type info to allow optimization extra verbose compilation tracing generate extra code(assertions) for debugging") DEFINE_bool(code_comments
static i::Isolate * i_isolate()
#define CALL_GENERATED_CODE(entry, p0, p1, p2, p3, p4)
static void GenerateHashAddCharacter(MacroAssembler *masm, Register hash, Register character)
void generate(MacroAssembler *masm, i::Vector< const uint8_t > string)
static Local< Context > New(Isolate *isolate, ExtensionConfiguration *extensions=NULL, Handle< ObjectTemplate > global_template=Handle< ObjectTemplate >(), Handle< Value > global_object=Handle< Value >())
uint32_t ComputeIntegerHash(uint32_t key, uint32_t seed)
static Flags ComputeFlags(Kind kind, InlineCacheState ic_state=UNINITIALIZED, ExtraICState extra_ic_state=kNoExtraICState, StubType type=NORMAL, InlineCacheHolderFlag holder=OWN_MAP)
Handle< Code > NewCode(const CodeDesc &desc, Code::Flags flags, Handle< Object > self_reference, bool immovable=false, bool crankshafted=false, int prologue_offset=Code::kPrologueOffsetNotSet)
static const int kEmptyHashField
static const int32_t kMaxOneByteCharCode
static void GenerateHashInit(MacroAssembler *masm, Register hash, Register character)
static v8::Isolate * isolate()