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

Side by Side Diff: src/compiler/ast-graph-builder.cc

Issue 969533004: [turbofan] Implement throwing exceptions into TurboFan code. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix code lookup. Created 5 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/compiler/ast-graph-builder.h ('k') | src/frames.h » ('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 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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/compiler/ast-graph-builder.h" 5 #include "src/compiler/ast-graph-builder.h"
6 6
7 #include "src/compiler.h" 7 #include "src/compiler.h"
8 #include "src/compiler/ast-loop-assignment-analyzer.h" 8 #include "src/compiler/ast-loop-assignment-analyzer.h"
9 #include "src/compiler/control-builders.h" 9 #include "src/compiler/control-builders.h"
10 #include "src/compiler/linkage.h" 10 #include "src/compiler/linkage.h"
(...skipping 1852 matching lines...) Expand 10 before | Expand all | Expand 10 after
1863 void AstGraphBuilder::VisitYield(Yield* expr) { 1863 void AstGraphBuilder::VisitYield(Yield* expr) {
1864 // TODO(turbofan): Implement yield here. 1864 // TODO(turbofan): Implement yield here.
1865 SetStackOverflow(); 1865 SetStackOverflow();
1866 ast_context()->ProduceValue(jsgraph()->UndefinedConstant()); 1866 ast_context()->ProduceValue(jsgraph()->UndefinedConstant());
1867 } 1867 }
1868 1868
1869 1869
1870 void AstGraphBuilder::VisitThrow(Throw* expr) { 1870 void AstGraphBuilder::VisitThrow(Throw* expr) {
1871 VisitForValue(expr->exception()); 1871 VisitForValue(expr->exception());
1872 Node* exception = environment()->Pop(); 1872 Node* exception = environment()->Pop();
1873 if (FLAG_turbo_exceptions) { 1873 Node* value = BuildThrowError(exception, expr->id());
1874 execution_control()->ThrowValue(exception); 1874 ast_context()->ProduceValue(value);
1875 ast_context()->ProduceValue(exception);
1876 } else {
1877 // TODO(mstarzinger): Temporary workaround for bailout-id for debugger.
1878 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1);
1879 Node* value = NewNode(op, exception);
1880 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine());
1881 ast_context()->ProduceValue(value);
1882 }
1883 } 1875 }
1884 1876
1885 1877
1886 void AstGraphBuilder::VisitProperty(Property* expr) { 1878 void AstGraphBuilder::VisitProperty(Property* expr) {
1887 Node* value; 1879 Node* value;
1888 VectorSlotPair pair = CreateVectorSlotPair(expr->PropertyFeedbackSlot()); 1880 VectorSlotPair pair = CreateVectorSlotPair(expr->PropertyFeedbackSlot());
1889 if (expr->key()->IsPropertyName()) { 1881 if (expr->key()->IsPropertyName()) {
1890 VisitForValue(expr->obj()); 1882 VisitForValue(expr->obj());
1891 Node* object = environment()->Pop(); 1883 Node* object = environment()->Pop();
1892 Unique<Name> name = MakeUnique(expr->key()->AsLiteral()->AsPropertyName()); 1884 Unique<Name> name = MakeUnique(expr->key()->AsLiteral()->AsPropertyName());
(...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 Expression* expr) { 2834 Expression* expr) {
2843 if (!FunctionLiteral::NeedsHomeObject(expr)) return value; 2835 if (!FunctionLiteral::NeedsHomeObject(expr)) return value;
2844 Unique<Name> name = MakeUnique(isolate()->factory()->home_object_symbol()); 2836 Unique<Name> name = MakeUnique(isolate()->factory()->home_object_symbol());
2845 const Operator* op = javascript()->StoreNamed(language_mode(), name); 2837 const Operator* op = javascript()->StoreNamed(language_mode(), name);
2846 Node* store = NewNode(op, value, home_object); 2838 Node* store = NewNode(op, value, home_object);
2847 PrepareFrameState(store, BailoutId::None()); 2839 PrepareFrameState(store, BailoutId::None());
2848 return store; 2840 return store;
2849 } 2841 }
2850 2842
2851 2843
2844 Node* AstGraphBuilder::BuildThrowError(Node* exception, BailoutId bailout_id) {
2845 const Operator* op = javascript()->CallRuntime(Runtime::kThrow, 1);
2846 Node* call = NewNode(op, exception);
2847 PrepareFrameState(call, bailout_id);
2848 return call;
2849 }
2850
2851
2852 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable, 2852 Node* AstGraphBuilder::BuildThrowReferenceError(Variable* variable,
2853 BailoutId bailout_id) { 2853 BailoutId bailout_id) {
2854 // TODO(mstarzinger): Should be unified with the VisitThrow implementation.
2855 Node* variable_name = jsgraph()->Constant(variable->name()); 2854 Node* variable_name = jsgraph()->Constant(variable->name());
2856 const Operator* op = 2855 const Operator* op =
2857 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1); 2856 javascript()->CallRuntime(Runtime::kThrowReferenceError, 1);
2858 Node* call = NewNode(op, variable_name); 2857 Node* call = NewNode(op, variable_name);
2859 PrepareFrameState(call, bailout_id); 2858 PrepareFrameState(call, bailout_id);
2860 return call; 2859 return call;
2861 } 2860 }
2862 2861
2863 2862
2864 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) { 2863 Node* AstGraphBuilder::BuildThrowConstAssignError(BailoutId bailout_id) {
2865 // TODO(mstarzinger): Should be unified with the VisitThrow implementation.
2866 const Operator* op = 2864 const Operator* op =
2867 javascript()->CallRuntime(Runtime::kThrowConstAssignError, 0); 2865 javascript()->CallRuntime(Runtime::kThrowConstAssignError, 0);
2868 Node* call = NewNode(op); 2866 Node* call = NewNode(op);
2869 PrepareFrameState(call, bailout_id); 2867 PrepareFrameState(call, bailout_id);
2870 return call; 2868 return call;
2871 } 2869 }
2872 2870
2873 2871
2874 Node* AstGraphBuilder::BuildReturn(Node* return_value) { 2872 Node* AstGraphBuilder::BuildReturn(Node* return_value) {
2875 Node* control = NewNode(common()->Return(), return_value); 2873 Node* control = NewNode(common()->Return(), return_value);
(...skipping 374 matching lines...) Expand 10 before | Expand all | Expand 10 after
3250 // Phi does not exist yet, introduce one. 3248 // Phi does not exist yet, introduce one.
3251 value = NewPhi(inputs, value, control); 3249 value = NewPhi(inputs, value, control);
3252 value->ReplaceInput(inputs - 1, other); 3250 value->ReplaceInput(inputs - 1, other);
3253 } 3251 }
3254 return value; 3252 return value;
3255 } 3253 }
3256 3254
3257 } // namespace compiler 3255 } // namespace compiler
3258 } // namespace internal 3256 } // namespace internal
3259 } // namespace v8 3257 } // namespace v8
OLDNEW
« no previous file with comments | « src/compiler/ast-graph-builder.h ('k') | src/frames.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698