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

Side by Side Diff: src/x64/stub-cache-x64.cc

Issue 167303005: Track field types. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Addressed comments 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/lithium-codegen-x64.cc ('k') | test/mjsunit/field-type-tracking.js » ('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 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 Representation representation = details.representation(); 487 Representation representation = details.representation();
488 ASSERT(!representation.IsNone()); 488 ASSERT(!representation.IsNone());
489 489
490 if (details.type() == CONSTANT) { 490 if (details.type() == CONSTANT) {
491 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); 491 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate());
492 __ Cmp(value_reg, constant); 492 __ Cmp(value_reg, constant);
493 __ j(not_equal, miss_label); 493 __ j(not_equal, miss_label);
494 } else if (representation.IsSmi()) { 494 } else if (representation.IsSmi()) {
495 __ JumpIfNotSmi(value_reg, miss_label); 495 __ JumpIfNotSmi(value_reg, miss_label);
496 } else if (representation.IsHeapObject()) { 496 } else if (representation.IsHeapObject()) {
497 __ JumpIfSmi(value_reg, miss_label); 497 HeapType* field_type = descriptors->GetFieldType(descriptor);
498 if (field_type->IsClass()) {
499 __ CheckMap(value_reg, field_type->AsClass(), miss_label, DO_SMI_CHECK);
500 } else {
501 ASSERT(HeapType::Any()->Is(field_type));
502 __ JumpIfSmi(value_reg, miss_label);
503 }
498 } else if (representation.IsDouble()) { 504 } else if (representation.IsDouble()) {
499 Label do_store, heap_number; 505 Label do_store, heap_number;
500 __ AllocateHeapNumber(storage_reg, scratch1, slow); 506 __ AllocateHeapNumber(storage_reg, scratch1, slow);
501 507
502 __ JumpIfNotSmi(value_reg, &heap_number); 508 __ JumpIfNotSmi(value_reg, &heap_number);
503 __ SmiToInteger32(scratch1, value_reg); 509 __ SmiToInteger32(scratch1, value_reg);
504 __ Cvtlsi2sd(xmm0, scratch1); 510 __ Cvtlsi2sd(xmm0, scratch1);
505 __ jmp(&do_store); 511 __ jmp(&do_store);
506 512
507 __ bind(&heap_number); 513 __ bind(&heap_number);
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
631 // Adjust for the number of properties stored in the object. Even in the 637 // Adjust for the number of properties stored in the object. Even in the
632 // face of a transition we can use the old map here because the size of the 638 // face of a transition we can use the old map here because the size of the
633 // object and the number of in-object properties is not going to change. 639 // object and the number of in-object properties is not going to change.
634 index -= object->map()->inobject_properties(); 640 index -= object->map()->inobject_properties();
635 641
636 Representation representation = lookup->representation(); 642 Representation representation = lookup->representation();
637 ASSERT(!representation.IsNone()); 643 ASSERT(!representation.IsNone());
638 if (representation.IsSmi()) { 644 if (representation.IsSmi()) {
639 __ JumpIfNotSmi(value_reg, miss_label); 645 __ JumpIfNotSmi(value_reg, miss_label);
640 } else if (representation.IsHeapObject()) { 646 } else if (representation.IsHeapObject()) {
641 __ JumpIfSmi(value_reg, miss_label); 647 HeapType* field_type = lookup->GetFieldType();
648 if (field_type->IsClass()) {
649 __ CheckMap(value_reg, field_type->AsClass(), miss_label, DO_SMI_CHECK);
650 } else {
651 ASSERT(HeapType::Any()->Is(field_type));
652 __ JumpIfSmi(value_reg, miss_label);
653 }
642 } else if (representation.IsDouble()) { 654 } else if (representation.IsDouble()) {
643 // Load the double storage. 655 // Load the double storage.
644 if (index < 0) { 656 if (index < 0) {
645 int offset = object->map()->instance_size() + (index * kPointerSize); 657 int offset = object->map()->instance_size() + (index * kPointerSize);
646 __ movp(scratch1, FieldOperand(receiver_reg, offset)); 658 __ movp(scratch1, FieldOperand(receiver_reg, offset));
647 } else { 659 } else {
648 __ movp(scratch1, 660 __ movp(scratch1,
649 FieldOperand(receiver_reg, JSObject::kPropertiesOffset)); 661 FieldOperand(receiver_reg, JSObject::kPropertiesOffset));
650 int offset = index * kPointerSize + FixedArray::kHeaderSize; 662 int offset = index * kPointerSize + FixedArray::kHeaderSize;
651 __ movp(scratch1, FieldOperand(scratch1, offset)); 663 __ movp(scratch1, FieldOperand(scratch1, offset));
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after
1442 // ----------------------------------- 1454 // -----------------------------------
1443 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss); 1455 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_Miss);
1444 } 1456 }
1445 1457
1446 1458
1447 #undef __ 1459 #undef __
1448 1460
1449 } } // namespace v8::internal 1461 } } // namespace v8::internal
1450 1462
1451 #endif // V8_TARGET_ARCH_X64 1463 #endif // V8_TARGET_ARCH_X64
OLDNEW
« no previous file with comments | « src/x64/lithium-codegen-x64.cc ('k') | test/mjsunit/field-type-tracking.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698