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

Side by Side Diff: src/x64/lithium-codegen-x64.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/x64/full-codegen-x64.cc ('k') | test/cctest/test-parsing.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 2013 the V8 project authors. All rights reserved. 1 // Copyright 2013 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 5318 matching lines...) Expand 10 before | Expand all | Expand 10 after
5329 Handle<String> type_name = instr->type_literal(); 5329 Handle<String> type_name = instr->type_literal();
5330 int left_block = instr->TrueDestination(chunk_); 5330 int left_block = instr->TrueDestination(chunk_);
5331 int right_block = instr->FalseDestination(chunk_); 5331 int right_block = instr->FalseDestination(chunk_);
5332 int next_block = GetNextEmittedBlock(); 5332 int next_block = GetNextEmittedBlock();
5333 5333
5334 Label::Distance true_distance = left_block == next_block ? Label::kNear 5334 Label::Distance true_distance = left_block == next_block ? Label::kNear
5335 : Label::kFar; 5335 : Label::kFar;
5336 Label::Distance false_distance = right_block == next_block ? Label::kNear 5336 Label::Distance false_distance = right_block == next_block ? Label::kNear
5337 : Label::kFar; 5337 : Label::kFar;
5338 Condition final_branch_condition = no_condition; 5338 Condition final_branch_condition = no_condition;
5339 if (type_name->Equals(heap()->number_string())) { 5339 Factory* factory = isolate()->factory();
5340 if (String::Equals(type_name, factory->number_string())) {
5340 __ JumpIfSmi(input, true_label, true_distance); 5341 __ JumpIfSmi(input, true_label, true_distance);
5341 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset), 5342 __ CompareRoot(FieldOperand(input, HeapObject::kMapOffset),
5342 Heap::kHeapNumberMapRootIndex); 5343 Heap::kHeapNumberMapRootIndex);
5343 5344
5344 final_branch_condition = equal; 5345 final_branch_condition = equal;
5345 5346
5346 } else if (type_name->Equals(heap()->string_string())) { 5347 } else if (String::Equals(type_name, factory->string_string())) {
5347 __ JumpIfSmi(input, false_label, false_distance); 5348 __ JumpIfSmi(input, false_label, false_distance);
5348 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input); 5349 __ CmpObjectType(input, FIRST_NONSTRING_TYPE, input);
5349 __ j(above_equal, false_label, false_distance); 5350 __ j(above_equal, false_label, false_distance);
5350 __ testb(FieldOperand(input, Map::kBitFieldOffset), 5351 __ testb(FieldOperand(input, Map::kBitFieldOffset),
5351 Immediate(1 << Map::kIsUndetectable)); 5352 Immediate(1 << Map::kIsUndetectable));
5352 final_branch_condition = zero; 5353 final_branch_condition = zero;
5353 5354
5354 } else if (type_name->Equals(heap()->symbol_string())) { 5355 } else if (String::Equals(type_name, factory->symbol_string())) {
5355 __ JumpIfSmi(input, false_label, false_distance); 5356 __ JumpIfSmi(input, false_label, false_distance);
5356 __ CmpObjectType(input, SYMBOL_TYPE, input); 5357 __ CmpObjectType(input, SYMBOL_TYPE, input);
5357 final_branch_condition = equal; 5358 final_branch_condition = equal;
5358 5359
5359 } else if (type_name->Equals(heap()->boolean_string())) { 5360 } else if (String::Equals(type_name, factory->boolean_string())) {
5360 __ CompareRoot(input, Heap::kTrueValueRootIndex); 5361 __ CompareRoot(input, Heap::kTrueValueRootIndex);
5361 __ j(equal, true_label, true_distance); 5362 __ j(equal, true_label, true_distance);
5362 __ CompareRoot(input, Heap::kFalseValueRootIndex); 5363 __ CompareRoot(input, Heap::kFalseValueRootIndex);
5363 final_branch_condition = equal; 5364 final_branch_condition = equal;
5364 5365
5365 } else if (FLAG_harmony_typeof && type_name->Equals(heap()->null_string())) { 5366 } else if (FLAG_harmony_typeof &&
5367 String::Equals(type_name, factory->null_string())) {
5366 __ CompareRoot(input, Heap::kNullValueRootIndex); 5368 __ CompareRoot(input, Heap::kNullValueRootIndex);
5367 final_branch_condition = equal; 5369 final_branch_condition = equal;
5368 5370
5369 } else if (type_name->Equals(heap()->undefined_string())) { 5371 } else if (String::Equals(type_name, factory->undefined_string())) {
5370 __ CompareRoot(input, Heap::kUndefinedValueRootIndex); 5372 __ CompareRoot(input, Heap::kUndefinedValueRootIndex);
5371 __ j(equal, true_label, true_distance); 5373 __ j(equal, true_label, true_distance);
5372 __ JumpIfSmi(input, false_label, false_distance); 5374 __ JumpIfSmi(input, false_label, false_distance);
5373 // Check for undetectable objects => true. 5375 // Check for undetectable objects => true.
5374 __ movp(input, FieldOperand(input, HeapObject::kMapOffset)); 5376 __ movp(input, FieldOperand(input, HeapObject::kMapOffset));
5375 __ testb(FieldOperand(input, Map::kBitFieldOffset), 5377 __ testb(FieldOperand(input, Map::kBitFieldOffset),
5376 Immediate(1 << Map::kIsUndetectable)); 5378 Immediate(1 << Map::kIsUndetectable));
5377 final_branch_condition = not_zero; 5379 final_branch_condition = not_zero;
5378 5380
5379 } else if (type_name->Equals(heap()->function_string())) { 5381 } else if (String::Equals(type_name, factory->function_string())) {
5380 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2); 5382 STATIC_ASSERT(NUM_OF_CALLABLE_SPEC_OBJECT_TYPES == 2);
5381 __ JumpIfSmi(input, false_label, false_distance); 5383 __ JumpIfSmi(input, false_label, false_distance);
5382 __ CmpObjectType(input, JS_FUNCTION_TYPE, input); 5384 __ CmpObjectType(input, JS_FUNCTION_TYPE, input);
5383 __ j(equal, true_label, true_distance); 5385 __ j(equal, true_label, true_distance);
5384 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE); 5386 __ CmpInstanceType(input, JS_FUNCTION_PROXY_TYPE);
5385 final_branch_condition = equal; 5387 final_branch_condition = equal;
5386 5388
5387 } else if (type_name->Equals(heap()->object_string())) { 5389 } else if (String::Equals(type_name, factory->object_string())) {
5388 __ JumpIfSmi(input, false_label, false_distance); 5390 __ JumpIfSmi(input, false_label, false_distance);
5389 if (!FLAG_harmony_typeof) { 5391 if (!FLAG_harmony_typeof) {
5390 __ CompareRoot(input, Heap::kNullValueRootIndex); 5392 __ CompareRoot(input, Heap::kNullValueRootIndex);
5391 __ j(equal, true_label, true_distance); 5393 __ j(equal, true_label, true_distance);
5392 } 5394 }
5393 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input); 5395 __ CmpObjectType(input, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, input);
5394 __ j(below, false_label, false_distance); 5396 __ j(below, false_label, false_distance);
5395 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 5397 __ CmpInstanceType(input, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
5396 __ j(above, false_label, false_distance); 5398 __ j(above, false_label, false_distance);
5397 // Check for undetectable objects => false. 5399 // Check for undetectable objects => false.
(...skipping 289 matching lines...) Expand 10 before | Expand all | Expand 10 after
5687 __ bind(deferred->exit()); 5689 __ bind(deferred->exit());
5688 __ bind(&done); 5690 __ bind(&done);
5689 } 5691 }
5690 5692
5691 5693
5692 #undef __ 5694 #undef __
5693 5695
5694 } } // namespace v8::internal 5696 } } // namespace v8::internal
5695 5697
5696 #endif // V8_TARGET_ARCH_X64 5698 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/full-codegen-x64.cc ('k') | test/cctest/test-parsing.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698