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

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

Issue 2407813002: [stubs] Port StringAddStub to TF (Closed)
Patch Set: Remove stray change Created 4 years, 2 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
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/ast/ast.h" 9 #include "src/ast/ast.h"
10 #include "src/bootstrapper.h" 10 #include "src/bootstrapper.h"
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 } 338 }
339 UNREACHABLE(); 339 UNREACHABLE();
340 return os; 340 return os;
341 } 341 }
342 342
343 343
344 void StringAddStub::PrintBaseName(std::ostream& os) const { // NOLINT 344 void StringAddStub::PrintBaseName(std::ostream& os) const { // NOLINT
345 os << "StringAddStub_" << flags() << "_" << pretenure_flag(); 345 os << "StringAddStub_" << flags() << "_" << pretenure_flag();
346 } 346 }
347 347
348 void StringAddStub::GenerateAssembly(CodeStubAssembler* assembler) const {
349 typedef compiler::Node Node;
350 Node* left = assembler->Parameter(Descriptor::kLeft);
351 Node* right = assembler->Parameter(Descriptor::kRight);
352 Node* context = assembler->Parameter(Descriptor::kContext);
353
354 if ((flags() & STRING_ADD_CHECK_LEFT) != 0) {
355 DCHECK((flags() & STRING_ADD_CONVERT) != 0);
356 left = assembler->ToString(context,
357 assembler->JSReceiverToPrimitive(context, left));
Igor Sheludko 2016/10/13 15:41:33 Note: we could generate a better code here if we c
danno 2016/10/17 14:23:26 Yes, but it somewhat breaks the abstraction of hav
358 }
359 if ((flags() & STRING_ADD_CHECK_RIGHT) != 0) {
360 DCHECK((flags() & STRING_ADD_CONVERT) != 0);
361 right = assembler->ToString(
362 context, assembler->JSReceiverToPrimitive(context, right));
363 }
364
365 if ((flags() & STRING_ADD_CHECK_BOTH) == 0) {
366 CodeStubAssembler::AllocationFlag flags =
367 (pretenure_flag() == TENURED) ? CodeStubAssembler::kPretenured
368 : CodeStubAssembler::kNone;
369 assembler->Return(assembler->StringAdd(context, left, right, flags));
370 } else {
371 StringAddStub stub(isolate(), STRING_ADD_CHECK_NONE, pretenure_flag());
372 StringAddDescriptor descriptor(isolate());
373 assembler->TailCallStub(descriptor, assembler->HeapConstant(stub.GetCode()),
Igor Sheludko 2016/10/13 15:41:33 I think Callable callable = CodeFactory::StringA
danno 2016/10/17 14:23:26 Done.
374 context, left, right);
375 }
376 }
348 377
349 InlineCacheState CompareICStub::GetICState() const { 378 InlineCacheState CompareICStub::GetICState() const {
350 CompareICState::State state = Max(left(), right()); 379 CompareICState::State state = Max(left(), right());
351 switch (state) { 380 switch (state) {
352 case CompareICState::UNINITIALIZED: 381 case CompareICState::UNINITIALIZED:
353 return ::v8::internal::UNINITIALIZED; 382 return ::v8::internal::UNINITIALIZED;
354 case CompareICState::BOOLEAN: 383 case CompareICState::BOOLEAN:
355 case CompareICState::SMI: 384 case CompareICState::SMI:
356 case CompareICState::NUMBER: 385 case CompareICState::NUMBER:
357 case CompareICState::INTERNALIZED_STRING: 386 case CompareICState::INTERNALIZED_STRING:
(...skipping 1798 matching lines...) Expand 10 before | Expand all | Expand 10 after
2156 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss); 2185 descriptor->SetMissHandler(Runtime::kBinaryOpIC_Miss);
2157 } 2186 }
2158 2187
2159 2188
2160 void BinaryOpWithAllocationSiteStub::InitializeDescriptor( 2189 void BinaryOpWithAllocationSiteStub::InitializeDescriptor(
2161 CodeStubDescriptor* descriptor) { 2190 CodeStubDescriptor* descriptor) {
2162 descriptor->Initialize( 2191 descriptor->Initialize(
2163 FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite)); 2192 FUNCTION_ADDR(Runtime_BinaryOpIC_MissWithAllocationSite));
2164 } 2193 }
2165 2194
2166
2167 void StringAddStub::InitializeDescriptor(CodeStubDescriptor* descriptor) {
2168 descriptor->Initialize(Runtime::FunctionForId(Runtime::kStringAdd)->entry);
2169 descriptor->SetMissHandler(Runtime::kStringAdd);
2170 }
2171
2172
2173 void GetPropertyStub::GenerateAssembly(CodeStubAssembler* assembler) const { 2195 void GetPropertyStub::GenerateAssembly(CodeStubAssembler* assembler) const {
2174 typedef compiler::Node Node; 2196 typedef compiler::Node Node;
2175 typedef CodeStubAssembler::Label Label; 2197 typedef CodeStubAssembler::Label Label;
2176 typedef CodeStubAssembler::Variable Variable; 2198 typedef CodeStubAssembler::Variable Variable;
2177 2199
2178 Label call_runtime(assembler, Label::kDeferred), return_undefined(assembler), 2200 Label call_runtime(assembler, Label::kDeferred), return_undefined(assembler),
2179 end(assembler); 2201 end(assembler);
2180 2202
2181 Node* object = assembler->Parameter(0); 2203 Node* object = assembler->Parameter(0);
2182 Node* key = assembler->Parameter(1); 2204 Node* key = assembler->Parameter(1);
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after
3033 3055
3034 if (type == MachineType::Pointer()) { 3056 if (type == MachineType::Pointer()) {
3035 return Representation::External(); 3057 return Representation::External();
3036 } 3058 }
3037 3059
3038 return Representation::Tagged(); 3060 return Representation::Tagged();
3039 } 3061 }
3040 3062
3041 } // namespace internal 3063 } // namespace internal
3042 } // namespace v8 3064 } // namespace v8
OLDNEW
« src/code-stub-assembler.cc ('K') | « 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