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

Side by Side Diff: src/x64/code-stubs-x64.cc

Issue 7191007: Cleanup: use JumpIf[Not]Smi() whenever we can (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: introduced new macro Created 9 years, 6 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/stub-cache-ia32.cc ('k') | src/x64/full-codegen-x64.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 2011 the V8 project authors. All rights reserved. 1 // Copyright 2011 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 230 matching lines...) Expand 10 before | Expand all | Expand 10 after
241 241
242 // Boolean -> its value 242 // Boolean -> its value
243 __ CompareRoot(rax, Heap::kFalseValueRootIndex); 243 __ CompareRoot(rax, Heap::kFalseValueRootIndex);
244 __ j(equal, &false_result); 244 __ j(equal, &false_result);
245 __ CompareRoot(rax, Heap::kTrueValueRootIndex); 245 __ CompareRoot(rax, Heap::kTrueValueRootIndex);
246 __ j(equal, &true_result); 246 __ j(equal, &true_result);
247 247
248 // Smis: 0 -> false, all other -> true 248 // Smis: 0 -> false, all other -> true
249 __ Cmp(rax, Smi::FromInt(0)); 249 __ Cmp(rax, Smi::FromInt(0));
250 __ j(equal, &false_result); 250 __ j(equal, &false_result);
251 Condition is_smi = __ CheckSmi(rax); 251 __ JumpIfSmi(rax, &true_result);
252 __ j(is_smi, &true_result);
253 252
254 // 'null' => false. 253 // 'null' => false.
255 __ CompareRoot(rax, Heap::kNullValueRootIndex); 254 __ CompareRoot(rax, Heap::kNullValueRootIndex);
256 __ j(equal, &false_result, Label::kNear); 255 __ j(equal, &false_result, Label::kNear);
257 256
258 // Get the map and type of the heap object. 257 // Get the map and type of the heap object.
259 // We don't use CmpObjectType because we manipulate the type field. 258 // We don't use CmpObjectType because we manipulate the type field.
260 __ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset)); 259 __ movq(rdx, FieldOperand(rax, HeapObject::kMapOffset));
261 __ movzxbq(rcx, FieldOperand(rdx, Map::kInstanceTypeOffset)); 260 __ movzxbq(rcx, FieldOperand(rdx, Map::kInstanceTypeOffset));
262 261
(...skipping 3532 matching lines...) Expand 10 before | Expand all | Expand 10 after
3795 void StringAddStub::Generate(MacroAssembler* masm) { 3794 void StringAddStub::Generate(MacroAssembler* masm) {
3796 Label string_add_runtime, call_builtin; 3795 Label string_add_runtime, call_builtin;
3797 Builtins::JavaScript builtin_id = Builtins::ADD; 3796 Builtins::JavaScript builtin_id = Builtins::ADD;
3798 3797
3799 // Load the two arguments. 3798 // Load the two arguments.
3800 __ movq(rax, Operand(rsp, 2 * kPointerSize)); // First argument (left). 3799 __ movq(rax, Operand(rsp, 2 * kPointerSize)); // First argument (left).
3801 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); // Second argument (right). 3800 __ movq(rdx, Operand(rsp, 1 * kPointerSize)); // Second argument (right).
3802 3801
3803 // Make sure that both arguments are strings if not known in advance. 3802 // Make sure that both arguments are strings if not known in advance.
3804 if (flags_ == NO_STRING_ADD_FLAGS) { 3803 if (flags_ == NO_STRING_ADD_FLAGS) {
3805 Condition is_smi; 3804 __ JumpIfSmi(rax, &string_add_runtime);
3806 is_smi = masm->CheckSmi(rax);
3807 __ j(is_smi, &string_add_runtime);
3808 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, r8); 3805 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, r8);
3809 __ j(above_equal, &string_add_runtime); 3806 __ j(above_equal, &string_add_runtime);
3810 3807
3811 // First argument is a a string, test second. 3808 // First argument is a a string, test second.
3812 is_smi = masm->CheckSmi(rdx); 3809 __ JumpIfSmi(rdx, &string_add_runtime);
3813 __ j(is_smi, &string_add_runtime);
3814 __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, r9); 3810 __ CmpObjectType(rdx, FIRST_NONSTRING_TYPE, r9);
3815 __ j(above_equal, &string_add_runtime); 3811 __ j(above_equal, &string_add_runtime);
3816 } else { 3812 } else {
3817 // Here at least one of the arguments is definitely a string. 3813 // Here at least one of the arguments is definitely a string.
3818 // We convert the one that is not known to be a string. 3814 // We convert the one that is not known to be a string.
3819 if ((flags_ & NO_STRING_CHECK_LEFT_IN_STUB) == 0) { 3815 if ((flags_ & NO_STRING_CHECK_LEFT_IN_STUB) == 0) {
3820 ASSERT((flags_ & NO_STRING_CHECK_RIGHT_IN_STUB) != 0); 3816 ASSERT((flags_ & NO_STRING_CHECK_RIGHT_IN_STUB) != 0);
3821 GenerateConvertArgument(masm, 2 * kPointerSize, rax, rbx, rcx, rdi, 3817 GenerateConvertArgument(masm, 2 * kPointerSize, rax, rbx, rcx, rdi,
3822 &call_builtin); 3818 &call_builtin);
3823 builtin_id = Builtins::STRING_ADD_RIGHT; 3819 builtin_id = Builtins::STRING_ADD_RIGHT;
(...skipping 1289 matching lines...) Expand 10 before | Expand all | Expand 10 after
5113 __ Drop(1); 5109 __ Drop(1);
5114 __ ret(2 * kPointerSize); 5110 __ ret(2 * kPointerSize);
5115 } 5111 }
5116 5112
5117 5113
5118 #undef __ 5114 #undef __
5119 5115
5120 } } // namespace v8::internal 5116 } } // namespace v8::internal
5121 5117
5122 #endif // V8_TARGET_ARCH_X64 5118 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/x64/full-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698