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

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

Issue 2152683003: Revert "VM: Array bounds checks that don't deoptimize for precompiled code." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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/assembler_x64.h ('k') | runtime/vm/constant_propagator.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 (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 "vm/code_generator.h" 5 #include "vm/code_generator.h"
6 6
7 #include "vm/assembler.h" 7 #include "vm/assembler.h"
8 #include "vm/ast.h" 8 #include "vm/ast.h"
9 #include "vm/code_patcher.h" 9 #include "vm/code_patcher.h"
10 #include "vm/compiler.h" 10 #include "vm/compiler.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 DEFINE_RUNTIME_ENTRY(TraceFunctionExit, 1) { 84 DEFINE_RUNTIME_ENTRY(TraceFunctionExit, 1) {
85 const Function& function = Function::CheckedHandle(arguments.ArgAt(0)); 85 const Function& function = Function::CheckedHandle(arguments.ArgAt(0));
86 const String& function_name = String::Handle(function.name()); 86 const String& function_name = String::Handle(function.name());
87 const String& class_name = 87 const String& class_name =
88 String::Handle(Class::Handle(function.Owner()).Name()); 88 String::Handle(Class::Handle(function.Owner()).Name());
89 OS::PrintErr("< Exiting '%s.%s'\n", 89 OS::PrintErr("< Exiting '%s.%s'\n",
90 class_name.ToCString(), function_name.ToCString()); 90 class_name.ToCString(), function_name.ToCString());
91 } 91 }
92 92
93 93
94 DEFINE_RUNTIME_ENTRY(RangeError, 2) {
95 const Instance& length = Instance::CheckedHandle(arguments.ArgAt(0));
96 const Instance& index = Instance::CheckedHandle(arguments.ArgAt(1));
97 if (!length.IsInteger()) {
98 // Throw: new ArgumentError.value(length, "length", "is not an integer");
99 const Array& args = Array::Handle(Array::New(3));
100 args.SetAt(0, length);
101 args.SetAt(1, Symbols::Length());
102 args.SetAt(2, String::Handle(String::New("is not an integer")));
103 Exceptions::ThrowByType(Exceptions::kArgumentValue, args);
104 }
105 if (!index.IsInteger()) {
106 // Throw: new ArgumentError.value(index, "index", "is not an integer");
107 const Array& args = Array::Handle(Array::New(3));
108 args.SetAt(0, index);
109 args.SetAt(1, Symbols::Index());
110 args.SetAt(2, String::Handle(String::New("is not an integer")));
111 Exceptions::ThrowByType(Exceptions::kArgumentValue, args);
112 }
113 // Throw: new RangeError.range(index, 0, length, "length");
114 const Array& args = Array::Handle(Array::New(4));
115 args.SetAt(0, index);
116 args.SetAt(1, Integer::Handle(Integer::New(0)));
117 args.SetAt(2, length);
118 args.SetAt(3, Symbols::Length());
119 Exceptions::ThrowByType(Exceptions::kRange, args);
120 }
121
122
123 // Allocation of a fixed length array of given element type. 94 // Allocation of a fixed length array of given element type.
124 // This runtime entry is never called for allocating a List of a generic type, 95 // This runtime entry is never called for allocating a List of a generic type,
125 // because a prior run time call instantiates the element type if necessary. 96 // because a prior run time call instantiates the element type if necessary.
126 // Arg0: array length. 97 // Arg0: array length.
127 // Arg1: array type arguments, i.e. vector of 1 type, the element type. 98 // Arg1: array type arguments, i.e. vector of 1 type, the element type.
128 // Return value: newly allocated array of length arg0. 99 // Return value: newly allocated array of length arg0.
129 DEFINE_RUNTIME_ENTRY(AllocateArray, 2) { 100 DEFINE_RUNTIME_ENTRY(AllocateArray, 2) {
130 const Instance& length = Instance::CheckedHandle(arguments.ArgAt(0)); 101 const Instance& length = Instance::CheckedHandle(arguments.ArgAt(0));
131 if (!length.IsInteger()) { 102 if (!length.IsInteger()) {
132 // Throw: new ArgumentError.value(length, "length", "is not an integer"); 103 // Throw: new ArgumentError.value(length, "length", "is not an integer");
(...skipping 1826 matching lines...) Expand 10 before | Expand all | Expand 10 after
1959 const intptr_t elm_size = old_data.ElementSizeInBytes(); 1930 const intptr_t elm_size = old_data.ElementSizeInBytes();
1960 const TypedData& new_data = 1931 const TypedData& new_data =
1961 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld)); 1932 TypedData::Handle(TypedData::New(cid, new_size, Heap::kOld));
1962 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size); 1933 TypedData::Copy(new_data, 0, old_data, 0, old_size * elm_size);
1963 typed_data_cell.SetAt(0, new_data); 1934 typed_data_cell.SetAt(0, new_data);
1964 arguments.SetReturn(new_data); 1935 arguments.SetReturn(new_data);
1965 } 1936 }
1966 1937
1967 1938
1968 } // namespace dart 1939 } // namespace dart
OLDNEW
« no previous file with comments | « runtime/vm/assembler_x64.h ('k') | runtime/vm/constant_propagator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698