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

Side by Side Diff: test/cctest/compiler/test-code-assembler.cc

Issue 2913783002: [builtins] Begin removing CodeFactory accessors (Closed)
Patch Set: V8_EXPORT_PRIVATE Created 3 years, 6 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 2015 the V8 project authors. All rights reserved. 1 // Copyright 2015 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-factory.h" 5 #include "src/code-factory.h"
6 #include "src/compiler/code-assembler.h" 6 #include "src/compiler/code-assembler.h"
7 #include "src/isolate.h" 7 #include "src/isolate.h"
8 #include "src/objects-inl.h" 8 #include "src/objects-inl.h"
9 #include "test/cctest/compiler/code-assembler-tester.h" 9 #include "test/cctest/compiler/code-assembler-tester.h"
10 #include "test/cctest/compiler/function-tester.h" 10 #include "test/cctest/compiler/function-tester.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 const int kNumParams = 1; 454 const int kNumParams = 1;
455 CodeAssemblerTester data(isolate, kNumParams); 455 CodeAssemblerTester data(isolate, kNumParams);
456 CodeAssembler m(data.state()); 456 CodeAssembler m(data.state());
457 457
458 Node* context = m.HeapConstant(Handle<Context>(isolate->native_context())); 458 Node* context = m.HeapConstant(Handle<Context>(isolate->native_context()));
459 Node* to_string_tag = 459 Node* to_string_tag =
460 m.HeapConstant(isolate->factory()->to_string_tag_symbol()); 460 m.HeapConstant(isolate->factory()->to_string_tag_symbol());
461 Variable exception(&m, MachineRepresentation::kTagged); 461 Variable exception(&m, MachineRepresentation::kTagged);
462 462
463 Label exception_handler(&m); 463 Label exception_handler(&m);
464 Callable to_string = CodeFactory::ToString(isolate); 464 Callable to_string = Builtins::CallableFor(isolate, Builtins::kToString);
465 Node* string = m.CallStub(to_string, context, to_string_tag); 465 Node* string = m.CallStub(to_string, context, to_string_tag);
466 m.GotoIfException(string, &exception_handler, &exception); 466 m.GotoIfException(string, &exception_handler, &exception);
467 m.Return(string); 467 m.Return(string);
468 468
469 m.Bind(&exception_handler); 469 m.Bind(&exception_handler);
470 m.Return(exception.value()); 470 m.Return(exception.value());
471 471
472 Handle<Code> code = data.GenerateCode(); 472 Handle<Code> code = data.GenerateCode();
473 CHECK(!code.is_null()); 473 CHECK(!code.is_null());
474 474
(...skipping 26 matching lines...) Expand all
501 501
502 Label exception_handler1(&m); 502 Label exception_handler1(&m);
503 Label exception_handler2(&m); 503 Label exception_handler2(&m);
504 Label exception_handler3(&m); 504 Label exception_handler3(&m);
505 Variable return_value(&m, MachineRepresentation::kWord32); 505 Variable return_value(&m, MachineRepresentation::kWord32);
506 Variable error(&m, MachineRepresentation::kTagged); 506 Variable error(&m, MachineRepresentation::kTagged);
507 507
508 return_value.Bind(m.Int32Constant(0)); 508 return_value.Bind(m.Int32Constant(0));
509 509
510 // try { return ToString(param1) } catch (e) { ... } 510 // try { return ToString(param1) } catch (e) { ... }
511 Callable to_string = CodeFactory::ToString(isolate); 511 Callable to_string = Builtins::CallableFor(isolate, Builtins::kToString);
512 Node* string = m.CallStub(to_string, context, first_value); 512 Node* string = m.CallStub(to_string, context, first_value);
513 m.GotoIfException(string, &exception_handler1, &error); 513 m.GotoIfException(string, &exception_handler1, &error);
514 m.Return(string); 514 m.Return(string);
515 515
516 // try { ToString(param2); return 7 } catch (e) { ... } 516 // try { ToString(param2); return 7 } catch (e) { ... }
517 m.Bind(&exception_handler1); 517 m.Bind(&exception_handler1);
518 return_value.Bind(m.Int32Constant(7)); 518 return_value.Bind(m.Int32Constant(7));
519 error.Bind(UndefinedConstant(m)); 519 error.Bind(UndefinedConstant(m));
520 string = m.CallStub(to_string, context, second_value); 520 string = m.CallStub(to_string, context, second_value);
521 m.GotoIfException(string, &exception_handler2, &error); 521 m.GotoIfException(string, &exception_handler2, &error);
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
571 Handle<Object> constructor = 571 Handle<Object> constructor =
572 Object::GetPropertyOrElement(result, 572 Object::GetPropertyOrElement(result,
573 isolate->factory()->constructor_string()) 573 isolate->factory()->constructor_string())
574 .ToHandleChecked(); 574 .ToHandleChecked();
575 CHECK(constructor->SameValue(*isolate->type_error_function())); 575 CHECK(constructor->SameValue(*isolate->type_error_function()));
576 } 576 }
577 577
578 } // namespace compiler 578 } // namespace compiler
579 } // namespace internal 579 } // namespace internal
580 } // namespace v8 580 } // namespace v8
OLDNEW
« no previous file with comments | « src/interpreter/interpreter-intrinsics-generator.cc ('k') | test/unittests/compiler/instruction-selector-unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698