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

Side by Side Diff: src/ia32/lithium-codegen-ia32.cc

Issue 225823003: Implement handlified String::Equals and Name::Equals. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: refactored StringToDouble Created 6 years, 8 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/full-codegen-ia32.cc ('k') | src/ic.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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 6076 matching lines...) Expand 10 before | Expand all | Expand 10 after
6087 Handle<String> type_name = instr->type_literal(); 6087 Handle<String> type_name = instr->type_literal();
6088 int left_block = instr->TrueDestination(chunk_); 6088 int left_block = instr->TrueDestination(chunk_);
6089 int right_block = instr->FalseDestination(chunk_); 6089 int right_block = instr->FalseDestination(chunk_);
6090 int next_block = GetNextEmittedBlock(); 6090 int next_block = GetNextEmittedBlock();
6091 6091
6092 Label::Distance true_distance = left_block == next_block ? Label::kNear 6092 Label::Distance true_distance = left_block == next_block ? Label::kNear
6093 : Label::kFar; 6093 : Label::kFar;
6094 Label::Distance false_distance = right_block == next_block ? Label::kNear 6094 Label::Distance false_distance = right_block == next_block ? Label::kNear
6095 : Label::kFar; 6095 : Label::kFar;
6096 Condition final_branch_condition = no_condition; 6096 Condition final_branch_condition = no_condition;
6097 if (type_name->Equals(heap()->number_string())) { 6097 if (String::Equals(type_name, factory()->number_string())) {
6098 __ JumpIfSmi(input, true_label, true_distance); 6098 __ JumpIfSmi(input, true_label, true_distance);
6099 __ cmp(FieldOperand(input, HeapObject::kMapOffset), 6099 __ cmp(FieldOperand(input, HeapObject::kMapOffset),
6100 factory()->heap_number_map()); 6100 factory()->heap_number_map());
6101 final_branch_condition = equal; 6101 final_branch_condition = equal;
6102 6102
6103 } else if (type_name->Equals(heap()->string_string())) { 6103 } else if (String::Equals(type_name, factory()->string_string())) {
6104 __ JumpIfSmi(input, false_label, false_distance); 6104 __ JumpIfSmi(input, false_label, false_distance);
6105 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); 6105 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input);
6106 __ j(above_equal, false_label, false_distance); 6106 __ j(above_equal, false_label, false_distance);
6107 __ test_b(FieldOperand(input, Map::kBitFieldOffset), 6107 __ test_b(FieldOperand(input, Map::kBitFieldOffset),
6108 1 << Map::kIsUndetectable); 6108 1 << Map::kIsUndetectable);
6109 final_branch_condition = zero; 6109 final_branch_condition = zero;
6110 6110
6111 } else if (type_name->Equals(heap()->symbol_string())) { 6111 } else if (String::Equals(type_name, factory()->symbol_string())) {
6112 __ JumpIfSmi(input, false_label, false_distance); 6112 __ JumpIfSmi(input, false_label, false_distance);
6113 __ CmpObjectType(input, SYMBOL_TYPE, input); 6113 __ CmpObjectType(input, SYMBOL_TYPE, input);
6114 final_branch_condition = equal; 6114 final_branch_condition = equal;
6115 6115
6116 } else if (type_name->Equals(heap()->boolean_string())) { 6116 } else if (String::Equals(type_name, factory()->boolean_string())) {
6117 __ cmp(input, factory()->true_value()); 6117 __ cmp(input, factory()->true_value());
6118 __ j(equal, true_label, true_distance); 6118 __ j(equal, true_label, true_distance);
6119 __ cmp(input, factory()->false_value()); 6119 __ cmp(input, factory()->false_value());
6120 final_branch_condition = equal; 6120 final_branch_condition = equal;
6121 6121
6122 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { 6122 } else if (FLAG_harmony_typeof &&
6123 String::Equals(type_name, factory()->null_string())) {
6123 __ cmp(input, factory()->null_value()); 6124 __ cmp(input, factory()->null_value());
6124 final_branch_condition = equal; 6125 final_branch_condition = equal;
6125 6126
6126 } else if (type_name->Equals(heap()->undefined_string())) { 6127 } else if (String::Equals(type_name, factory()->undefined_string())) {
6127 __ cmp(input, factory()->undefined_value()); 6128 __ cmp(input, factory()->undefined_value());
6128 __ j(equal, true_label, true_distance); 6129 __ j(equal, true_label, true_distance);
6129 __ JumpIfSmi(input, false_label, false_distance); 6130 __ JumpIfSmi(input, false_label, false_distance);
6130 // Check for undetectable objects => true. 6131 // Check for undetectable objects => true.
6131 __ mov(input, FieldOperand(input, HeapObject::kMapOffset)); 6132 __ mov(input, FieldOperand(input, HeapObject::kMapOffset));
6132 __ test_b(FieldOperand(input, Map::kBitFieldOffset), 6133 __ test_b(FieldOperand(input, Map::kBitFieldOffset),
6133 1 << Map::kIsUndetectable); 6134 1 << Map::kIsUndetectable);
6134 final_branch_condition = not_zero; 6135 final_branch_condition = not_zero;
6135 6136
6136 } else if (type_name->Equals(heap()->function_string())) { 6137 } else if (String::Equals(type_name, factory()->function_string())) {
6137 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); 6138 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
6138 __ JumpIfSmi(input, false_label, false_distance); 6139 __ JumpIfSmi(input, false_label, false_distance);
6139 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); 6140 __ CmpObjectType(input, JS_FUNCTION_TYPE, input);
6140 __ j(equal, true_label, true_distance); 6141 __ j(equal, true_label, true_distance);
6141 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); 6142 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE);
6142 final_branch_condition = equal; 6143 final_branch_condition = equal;
6143 6144
6144 } else if (type_name->Equals(heap()->object_string())) { 6145 } else if (String::Equals(type_name, factory()->object_string())) {
6145 __ JumpIfSmi(input, false_label, false_distance); 6146 __ JumpIfSmi(input, false_label, false_distance);
6146 if (!FLAG_harmony_typeof) { 6147 if (!FLAG_harmony_typeof) {
6147 __ cmp(input, factory()->null_value()); 6148 __ cmp(input, factory()->null_value());
6148 __ j(equal, true_label, true_distance); 6149 __ j(equal, true_label, true_distance);
6149 } 6150 }
6150 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); 6151 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input);
6151 __ j(below, false_label, false_distance); 6152 __ j(below, false_label, false_distance);
6152 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 6153 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
6153 __ j(above, false_label, false_distance); 6154 __ j(above, false_label, false_distance);
6154 // Check for undetectable objects => false. 6155 // Check for undetectable objects => false.
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
6448 __ bind(deferred->exit()); 6449 __ bind(deferred->exit());
6449 __ bind(&done); 6450 __ bind(&done);
6450 } 6451 }
6451 6452
6452 6453
6453 #undef __ 6454 #undef __
6454 6455
6455 } } // namespace v8::internal 6456 } } // namespace v8::internal
6456 6457
6457 #endif // V8_TARGET_ARCH_IA32 6458 #endif // V8_TARGET_ARCH_IA32
OLDNEW
« no previous file with comments | « src/ia32/full-codegen-ia32.cc ('k') | src/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698