Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Side by Side Diff: src/x64/macro-assembler-x64.cc

Issue 3141022: Using array index hash code for string-to-number conversion. (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/mjsunit/fuzz-natives.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2009 the V8 project authors. All rights reserved. 1 // Copyright 2009 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 384
385 385
386 void MacroAssembler::IllegalOperation(int num_arguments) { 386 void MacroAssembler::IllegalOperation(int num_arguments) {
387 if (num_arguments > 0) { 387 if (num_arguments > 0) {
388 addq(rsp, Immediate(num_arguments * kPointerSize)); 388 addq(rsp, Immediate(num_arguments * kPointerSize));
389 } 389 }
390 LoadRoot(rax, Heap::kUndefinedValueRootIndex); 390 LoadRoot(rax, Heap::kUndefinedValueRootIndex);
391 } 391 }
392 392
393 393
394 void MacroAssembler::IndexFromHash(Register hash, Register index) {
395 // The assert checks that the constants for the maximum number of digits
396 // for an array index cached in the hash field and the number of bits
397 // reserved for it does not conflict.
398 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) <
399 (1 << String::kArrayIndexValueBits));
400 // We want the smi-tagged index in key. Even if we subsequently go to
401 // the slow case, converting the key to a smi is always valid.
402 // key: string key
403 // hash: key's hash field, including its array index value.
404 and_(hash, Immediate(String::kArrayIndexValueMask));
405 shr(hash, Immediate(String::kHashShift));
406 // Here we actually clobber the key which will be used if calling into
407 // runtime later. However as the new key is the numeric value of a string key
408 // there is no difference in using either key.
409 Integer32ToSmi(index, hash);
410 }
411
412
394 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { 413 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) {
395 CallRuntime(Runtime::FunctionForId(id), num_arguments); 414 CallRuntime(Runtime::FunctionForId(id), num_arguments);
396 } 415 }
397 416
398 417
399 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id, 418 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id,
400 int num_arguments) { 419 int num_arguments) {
401 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments); 420 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments);
402 } 421 }
403 422
(...skipping 2557 matching lines...) Expand 10 before | Expand all | Expand 10 after
2961 CPU::FlushICache(address_, size_); 2980 CPU::FlushICache(address_, size_);
2962 2981
2963 // Check that the code was patched as expected. 2982 // Check that the code was patched as expected.
2964 ASSERT(masm_.pc_ == address_ + size_); 2983 ASSERT(masm_.pc_ == address_ + size_);
2965 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 2984 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
2966 } 2985 }
2967 2986
2968 } } // namespace v8::internal 2987 } } // namespace v8::internal
2969 2988
2970 #endif // V8_TARGET_ARCH_X64 2989 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/macro-assembler-x64.h ('k') | test/mjsunit/fuzz-natives.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698