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

Side by Side Diff: src/ia32/macro-assembler-ia32.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/ia32/macro-assembler-ia32.h ('k') | src/runtime.cc » ('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 2006-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 bind(&ok); 370 bind(&ok);
371 } 371 }
372 372
373 373
374 void MacroAssembler::AbortIfNotSmi(Register object) { 374 void MacroAssembler::AbortIfNotSmi(Register object) {
375 test(object, Immediate(kSmiTagMask)); 375 test(object, Immediate(kSmiTagMask));
376 Assert(equal, "Operand is not a smi"); 376 Assert(equal, "Operand is not a smi");
377 } 377 }
378 378
379 379
380 void MacroAssembler::AbortIfNotString(Register object) {
381 test(object, Immediate(kSmiTagMask));
382 Assert(not_equal, "Operand is not a string");
383 push(object);
384 mov(object, FieldOperand(object, HeapObject::kMapOffset));
385 CmpInstanceType(object, FIRST_NONSTRING_TYPE);
386 pop(object);
387 Assert(below, "Operand is not a string");
388 }
389
390
380 void MacroAssembler::AbortIfSmi(Register object) { 391 void MacroAssembler::AbortIfSmi(Register object) {
381 test(object, Immediate(kSmiTagMask)); 392 test(object, Immediate(kSmiTagMask));
382 Assert(not_equal, "Operand is a smi"); 393 Assert(not_equal, "Operand is a smi");
383 } 394 }
384 395
385 396
386 void MacroAssembler::EnterFrame(StackFrame::Type type) { 397 void MacroAssembler::EnterFrame(StackFrame::Type type) {
387 push(ebp); 398 push(ebp);
388 mov(ebp, Operand(esp)); 399 mov(ebp, Operand(esp));
389 push(esi); 400 push(esi);
(...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 1044
1034 1045
1035 void MacroAssembler::IllegalOperation(int num_arguments) { 1046 void MacroAssembler::IllegalOperation(int num_arguments) {
1036 if (num_arguments > 0) { 1047 if (num_arguments > 0) {
1037 add(Operand(esp), Immediate(num_arguments * kPointerSize)); 1048 add(Operand(esp), Immediate(num_arguments * kPointerSize));
1038 } 1049 }
1039 mov(eax, Immediate(Factory::undefined_value())); 1050 mov(eax, Immediate(Factory::undefined_value()));
1040 } 1051 }
1041 1052
1042 1053
1054 void MacroAssembler::IndexFromHash(Register hash, Register index) {
1055 // The assert checks that the constants for the maximum number of digits
1056 // for an array index cached in the hash field and the number of bits
1057 // reserved for it does not conflict.
1058 ASSERT(TenToThe(String::kMaxCachedArrayIndexLength) <
1059 (1 << String::kArrayIndexValueBits));
1060 // We want the smi-tagged index in key. kArrayIndexValueMask has zeros in
1061 // the low kHashShift bits.
1062 and_(hash, String::kArrayIndexValueMask);
1063 STATIC_ASSERT(String::kHashShift >= kSmiTagSize && kSmiTag == 0);
1064 if (String::kHashShift > kSmiTagSize) {
1065 shr(hash, String::kHashShift - kSmiTagSize);
1066 }
1067 if (!index.is(hash)) {
1068 mov(index, hash);
1069 }
1070 }
1071
1072
1043 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) { 1073 void MacroAssembler::CallRuntime(Runtime::FunctionId id, int num_arguments) {
1044 CallRuntime(Runtime::FunctionForId(id), num_arguments); 1074 CallRuntime(Runtime::FunctionForId(id), num_arguments);
1045 } 1075 }
1046 1076
1047 1077
1048 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id, 1078 Object* MacroAssembler::TryCallRuntime(Runtime::FunctionId id,
1049 int num_arguments) { 1079 int num_arguments) {
1050 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments); 1080 return TryCallRuntime(Runtime::FunctionForId(id), num_arguments);
1051 } 1081 }
1052 1082
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1699 1729
1700 // Check that the code was patched as expected. 1730 // Check that the code was patched as expected.
1701 ASSERT(masm_.pc_ == address_ + size_); 1731 ASSERT(masm_.pc_ == address_ + size_);
1702 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap); 1732 ASSERT(masm_.reloc_info_writer.pos() == address_ + size_ + Assembler::kGap);
1703 } 1733 }
1704 1734
1705 1735
1706 } } // namespace v8::internal 1736 } } // namespace v8::internal
1707 1737
1708 #endif // V8_TARGET_ARCH_IA32 1738 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/macro-assembler-ia32.h ('k') | src/runtime.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698