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

Side by Side Diff: src/x64/full-codegen-x64.cc

Issue 12957004: ES6 symbols: turn symbols into a proper primitive type (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments Created 7 years, 9 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/builtins-x64.cc ('k') | src/x64/lithium-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 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 2660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2671 // default valueOf and set true result. 2671 // default valueOf and set true result.
2672 __ or_(FieldOperand(rbx, Map::kBitField2Offset), 2672 __ or_(FieldOperand(rbx, Map::kBitField2Offset),
2673 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf)); 2673 Immediate(1 << Map::kStringWrapperSafeForDefaultValueOf));
2674 __ jmp(if_true); 2674 __ jmp(if_true);
2675 2675
2676 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false); 2676 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
2677 context()->Plug(if_true, if_false); 2677 context()->Plug(if_true, if_false);
2678 } 2678 }
2679 2679
2680 2680
2681 void FullCodeGenerator::EmitIsSymbol(CallRuntime* expr) {
2682 ZoneList<Expression*>* args = expr->arguments();
2683 ASSERT(args->length() == 1);
2684
2685 VisitForAccumulatorValue(args->at(0));
2686
2687 Label materialize_true, materialize_false;
2688 Label* if_true = NULL;
2689 Label* if_false = NULL;
2690 Label* fall_through = NULL;
2691 context()->PrepareTest(&materialize_true, &materialize_false,
2692 &if_true, &if_false, &fall_through);
2693
2694 __ JumpIfSmi(rax, if_false);
2695 __ CmpObjectType(rax, SYMBOL_TYPE, rbx);
2696 PrepareForBailoutBeforeSplit(expr, true, if_true, if_false);
2697 Split(equal, if_true, if_false, fall_through);
2698
2699 context()->Plug(if_true, if_false);
2700 }
2701
2702
2703 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) { 2681 void FullCodeGenerator::EmitIsFunction(CallRuntime* expr) {
2704 ZoneList<Expression*>* args = expr->arguments(); 2682 ZoneList<Expression*>* args = expr->arguments();
2705 ASSERT(args->length() == 1); 2683 ASSERT(args->length() == 1);
2706 2684
2707 VisitForAccumulatorValue(args->at(0)); 2685 VisitForAccumulatorValue(args->at(0));
2708 2686
2709 Label materialize_true, materialize_false; 2687 Label materialize_true, materialize_false;
2710 Label* if_true = NULL; 2688 Label* if_true = NULL;
2711 Label* if_false = NULL; 2689 Label* if_false = NULL;
2712 Label* fall_through = NULL; 2690 Label* fall_through = NULL;
(...skipping 1551 matching lines...) Expand 10 before | Expand all | Expand 10 after
4264 __ CompareRoot(rax, Heap::kHeapNumberMapRootIndex); 4242 __ CompareRoot(rax, Heap::kHeapNumberMapRootIndex);
4265 Split(equal, if_true, if_false, fall_through); 4243 Split(equal, if_true, if_false, fall_through);
4266 } else if (check->Equals(isolate()->heap()->string_string())) { 4244 } else if (check->Equals(isolate()->heap()->string_string())) {
4267 __ JumpIfSmi(rax, if_false); 4245 __ JumpIfSmi(rax, if_false);
4268 // Check for undetectable objects => false. 4246 // Check for undetectable objects => false.
4269 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx); 4247 __ CmpObjectType(rax, FIRST_NONSTRING_TYPE, rdx);
4270 __ j(above_equal, if_false); 4248 __ j(above_equal, if_false);
4271 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), 4249 __ testb(FieldOperand(rdx, Map::kBitFieldOffset),
4272 Immediate(1 << Map::kIsUndetectable)); 4250 Immediate(1 << Map::kIsUndetectable));
4273 Split(zero, if_true, if_false, fall_through); 4251 Split(zero, if_true, if_false, fall_through);
4252 } else if (check->Equals(isolate()->heap()->symbol_string())) {
4253 __ JumpIfSmi(rax, if_false);
4254 __ CmpObjectType(rax, SYMBOL_TYPE, rdx);
4255 Split(equal, if_true, if_false, fall_through);
4274 } else if (check->Equals(isolate()->heap()->boolean_string())) { 4256 } else if (check->Equals(isolate()->heap()->boolean_string())) {
4275 __ CompareRoot(rax, Heap::kTrueValueRootIndex); 4257 __ CompareRoot(rax, Heap::kTrueValueRootIndex);
4276 __ j(equal, if_true); 4258 __ j(equal, if_true);
4277 __ CompareRoot(rax, Heap::kFalseValueRootIndex); 4259 __ CompareRoot(rax, Heap::kFalseValueRootIndex);
4278 Split(equal, if_true, if_false, fall_through); 4260 Split(equal, if_true, if_false, fall_through);
4279 } else if (FLAG_harmony_typeof && 4261 } else if (FLAG_harmony_typeof &&
4280 check->Equals(isolate()->heap()->null_string())) { 4262 check->Equals(isolate()->heap()->null_string())) {
4281 __ CompareRoot(rax, Heap::kNullValueRootIndex); 4263 __ CompareRoot(rax, Heap::kNullValueRootIndex);
4282 Split(equal, if_true, if_false, fall_through); 4264 Split(equal, if_true, if_false, fall_through);
4283 } else if (check->Equals(isolate()->heap()->undefined_string())) { 4265 } else if (check->Equals(isolate()->heap()->undefined_string())) {
(...skipping 11 matching lines...) Expand all
4295 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rdx); 4277 __ CmpObjectType(rax, JS_FUNCTION_TYPE, rdx);
4296 __ j(equal, if_true); 4278 __ j(equal, if_true);
4297 __ CmpInstanceType(rdx, JS_FUNCTION_PROXY_TYPE); 4279 __ CmpInstanceType(rdx, JS_FUNCTION_PROXY_TYPE);
4298 Split(equal, if_true, if_false, fall_through); 4280 Split(equal, if_true, if_false, fall_through);
4299 } else if (check->Equals(isolate()->heap()->object_string())) { 4281 } else if (check->Equals(isolate()->heap()->object_string())) {
4300 __ JumpIfSmi(rax, if_false); 4282 __ JumpIfSmi(rax, if_false);
4301 if (!FLAG_harmony_typeof) { 4283 if (!FLAG_harmony_typeof) {
4302 __ CompareRoot(rax, Heap::kNullValueRootIndex); 4284 __ CompareRoot(rax, Heap::kNullValueRootIndex);
4303 __ j(equal, if_true); 4285 __ j(equal, if_true);
4304 } 4286 }
4305 if (FLAG_harmony_symbols) {
4306 __ CmpObjectType(rax, SYMBOL_TYPE, rdx);
4307 __ j(equal, if_true);
4308 }
4309 __ CmpObjectType(rax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, rdx); 4287 __ CmpObjectType(rax, FIRST_NONCALLABLE_SPEC_OBJECT_TYPE, rdx);
4310 __ j(below, if_false); 4288 __ j(below, if_false);
4311 __ CmpInstanceType(rdx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE); 4289 __ CmpInstanceType(rdx, LAST_NONCALLABLE_SPEC_OBJECT_TYPE);
4312 __ j(above, if_false); 4290 __ j(above, if_false);
4313 // Check for undetectable objects => false. 4291 // Check for undetectable objects => false.
4314 __ testb(FieldOperand(rdx, Map::kBitFieldOffset), 4292 __ testb(FieldOperand(rdx, Map::kBitFieldOffset),
4315 Immediate(1 << Map::kIsUndetectable)); 4293 Immediate(1 << Map::kIsUndetectable));
4316 Split(zero, if_true, if_false, fall_through); 4294 Split(zero, if_true, if_false, fall_through);
4317 } else { 4295 } else {
4318 if (if_false != fall_through) __ jmp(if_false); 4296 if (if_false != fall_through) __ jmp(if_false);
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
4573 *context_length = 0; 4551 *context_length = 0;
4574 return previous_; 4552 return previous_;
4575 } 4553 }
4576 4554
4577 4555
4578 #undef __ 4556 #undef __
4579 4557
4580 } } // namespace v8::internal 4558 } } // namespace v8::internal
4581 4559
4582 #endif // V8_TARGET_ARCH_X64 4560 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/builtins-x64.cc ('k') | src/x64/lithium-codegen-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698