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

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

Issue 1735803003: [turbofan] Adds an Allocate macro to the CodeStubAssembler. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Update. Created 4 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
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.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 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/code-stubs.h" 5 #include "src/code-stubs.h"
6 6
7 #include <sstream> 7 #include <sstream>
8 8
9 #include "src/bootstrapper.h" 9 #include "src/bootstrapper.h"
10 #include "src/compiler/code-stub-assembler.h" 10 #include "src/compiler/code-stub-assembler.h"
(...skipping 444 matching lines...) Expand 10 before | Expand all | Expand 10 after
455 Handle<Code> TurboFanCodeStub::GenerateCode() { 455 Handle<Code> TurboFanCodeStub::GenerateCode() {
456 const char* name = CodeStub::MajorName(MajorKey()); 456 const char* name = CodeStub::MajorName(MajorKey());
457 Zone zone; 457 Zone zone;
458 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor()); 458 CallInterfaceDescriptor descriptor(GetCallInterfaceDescriptor());
459 compiler::CodeStubAssembler assembler(isolate(), &zone, descriptor, 459 compiler::CodeStubAssembler assembler(isolate(), &zone, descriptor,
460 GetCodeFlags(), name); 460 GetCodeFlags(), name);
461 GenerateAssembly(&assembler); 461 GenerateAssembly(&assembler);
462 return assembler.GenerateCode(); 462 return assembler.GenerateCode();
463 } 463 }
464 464
465 void AllocateHeapNumberStub::GenerateAssembly(
466 compiler::CodeStubAssembler* assembler) const {
467 compiler::Node* result = assembler->Allocate(
468 HeapNumber::kSize, compiler::CodeStubAssembler::kNone);
469 compiler::Node* map_offset =
470 assembler->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag);
471 compiler::Node* map = assembler->IntPtrAdd(result, map_offset);
472 assembler->StoreNoWriteBarrier(
473 MachineRepresentation::kTagged, map,
474 assembler->HeapConstant(isolate()->factory()->heap_number_map()));
475 assembler->Return(result);
476 }
477
478 void AllocateMutableHeapNumberStub::GenerateAssembly(
479 compiler::CodeStubAssembler* assembler) const {
480 compiler::Node* result = assembler->Allocate(
481 HeapNumber::kSize, compiler::CodeStubAssembler::kNone);
482 compiler::Node* map_offset =
483 assembler->IntPtrConstant(HeapObject::kMapOffset - kHeapObjectTag);
484 compiler::Node* map = assembler->IntPtrAdd(result, map_offset);
485 assembler->StoreNoWriteBarrier(
486 MachineRepresentation::kTagged, map,
487 assembler->HeapConstant(isolate()->factory()->mutable_heap_number_map()));
488 assembler->Return(result);
489 }
465 490
466 void StringLengthStub::GenerateAssembly( 491 void StringLengthStub::GenerateAssembly(
467 compiler::CodeStubAssembler* assembler) const { 492 compiler::CodeStubAssembler* assembler) const {
468 compiler::Node* value = assembler->Parameter(0); 493 compiler::Node* value = assembler->Parameter(0);
469 compiler::Node* string = 494 compiler::Node* string =
470 assembler->LoadObjectField(value, JSValue::kValueOffset); 495 assembler->LoadObjectField(value, JSValue::kValueOffset);
471 compiler::Node* result = 496 compiler::Node* result =
472 assembler->LoadObjectField(string, String::kLengthOffset); 497 assembler->LoadObjectField(string, String::kLengthOffset);
473 assembler->Return(result); 498 assembler->Return(result);
474 } 499 }
(...skipping 566 matching lines...) Expand 10 before | Expand all | Expand 10 after
1041 if (type->Is(Type::UntaggedPointer())) { 1066 if (type->Is(Type::UntaggedPointer())) {
1042 return Representation::External(); 1067 return Representation::External();
1043 } 1068 }
1044 1069
1045 DCHECK(!type->Is(Type::Untagged())); 1070 DCHECK(!type->Is(Type::Untagged()));
1046 return Representation::Tagged(); 1071 return Representation::Tagged();
1047 } 1072 }
1048 1073
1049 } // namespace internal 1074 } // namespace internal
1050 } // namespace v8 1075 } // namespace v8
OLDNEW
« no previous file with comments | « src/code-stubs.h ('k') | src/code-stubs-hydrogen.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698