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

Side by Side Diff: runtime/vm/kernel_to_il.cc

Issue 2857853003: Fix building of parameter descriptors from Kernel (Closed)
Patch Set: Created 3 years, 7 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 | « runtime/vm/kernel_to_il.h ('k') | tests/lib/lib.status » ('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 (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 #include <set> 5 #include <set>
6 6
7 #include "vm/kernel_to_il.h" 7 #include "vm/kernel_to_il.h"
8 8
9 #include "vm/compiler.h" 9 #include "vm/compiler.h"
10 #include "vm/intermediate_language.h" 10 #include "vm/intermediate_language.h"
(...skipping 6760 matching lines...) Expand 10 before | Expand all | Expand 10 after
6771 } else { 6771 } else {
6772 Thread* thread = Thread::Current(); 6772 Thread* thread = Thread::Current();
6773 Error& error = Error::Handle(); 6773 Error& error = Error::Handle();
6774 error = thread->sticky_error(); 6774 error = thread->sticky_error();
6775 thread->clear_sticky_error(); 6775 thread->clear_sticky_error();
6776 return error.raw(); 6776 return error.raw();
6777 } 6777 }
6778 } 6778 }
6779 6779
6780 6780
6781 RawObject* BuildParameterDescriptor(TreeNode* const kernel_node) { 6781 RawObject* BuildParameterDescriptor(const Function& function) {
6782 LongJumpScope jump; 6782 LongJumpScope jump;
6783 if (setjmp(*jump.Set()) == 0) { 6783 if (setjmp(*jump.Set()) == 0) {
6784 TreeNode* kernel_node =
6785 reinterpret_cast<TreeNode*>(function.kernel_function());
6784 FunctionNode* function_node = NULL; 6786 FunctionNode* function_node = NULL;
6785
6786 if (kernel_node->IsProcedure()) { 6787 if (kernel_node->IsProcedure()) {
6787 function_node = Procedure::Cast(kernel_node)->function(); 6788 function_node = Procedure::Cast(kernel_node)->function();
6788 } else if (kernel_node->IsConstructor()) { 6789 } else if (kernel_node->IsConstructor()) {
6789 function_node = Constructor::Cast(kernel_node)->function(); 6790 function_node = Constructor::Cast(kernel_node)->function();
6790 } else if (kernel_node->IsFunctionNode()) { 6791 } else if (kernel_node->IsFunctionNode()) {
6791 function_node = FunctionNode::Cast(kernel_node); 6792 function_node = FunctionNode::Cast(kernel_node);
6792 } else { 6793 } else {
6793 UNIMPLEMENTED(); 6794 UNIMPLEMENTED();
6794 return NULL; 6795 return NULL;
6795 } 6796 }
6796 6797
6797 Thread* thread = Thread::Current(); 6798 Thread* thread = Thread::Current();
6798 Zone* zone_ = thread->zone(); 6799 Zone* zone_ = thread->zone();
6799 TranslationHelper translation_helper(thread); 6800 TranslationHelper helper(thread);
6800 DartTypeTranslator type_translator(&translation_helper, NULL, true); 6801 Script& script = Script::Handle(Z, function.script());
6802 helper.SetStringOffsets(
6803 TypedData::Handle(Z, script.kernel_string_offsets()));
6804 helper.SetStringData(TypedData::Handle(Z, script.kernel_string_data()));
6805 DartTypeTranslator type_translator(&helper, NULL, true);
6801 ConstantEvaluator constant_evaluator(/* flow_graph_builder = */ NULL, Z, 6806 ConstantEvaluator constant_evaluator(/* flow_graph_builder = */ NULL, Z,
6802 &translation_helper, &type_translator); 6807 &helper, &type_translator);
6803 6808
6804 const intptr_t positional_count = 6809 const intptr_t positional_count =
6805 function_node->positional_parameters().length(); 6810 function_node->positional_parameters().length();
6806 const intptr_t param_count = 6811 const intptr_t param_count =
6807 positional_count + function_node->named_parameters().length(); 6812 positional_count + function_node->named_parameters().length();
6808 const Array& param_descriptor = Array::Handle( 6813 const Array& param_descriptor = Array::Handle(
6809 Array::New(param_count * Parser::kParameterEntrySize, Heap::kOld)); 6814 Array::New(param_count * Parser::kParameterEntrySize, Heap::kOld));
6810 for (intptr_t i = 0; i < param_count; ++i) { 6815 for (intptr_t i = 0; i < param_count; ++i) {
6811 const intptr_t entry_start = i * Parser::kParameterEntrySize; 6816 const intptr_t entry_start = i * Parser::kParameterEntrySize;
6812 6817
(...skipping 30 matching lines...) Expand all
6843 thread->clear_sticky_error(); 6848 thread->clear_sticky_error();
6844 return error.raw(); 6849 return error.raw();
6845 } 6850 }
6846 } 6851 }
6847 6852
6848 6853
6849 } // namespace kernel 6854 } // namespace kernel
6850 } // namespace dart 6855 } // namespace dart
6851 6856
6852 #endif // !defined(DART_PRECOMPILED_RUNTIME) 6857 #endif // !defined(DART_PRECOMPILED_RUNTIME)
OLDNEW
« no previous file with comments | « runtime/vm/kernel_to_il.h ('k') | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698