OLD | NEW |
1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 | 152 |
153 | 153 |
154 static Object* Runtime_CreateArrayLiteral(Arguments args) { | 154 static Object* Runtime_CreateArrayLiteral(Arguments args) { |
155 // Takes a FixedArray of elements containing the literal elements of | 155 // Takes a FixedArray of elements containing the literal elements of |
156 // the array literal and produces JSArray with those elements. | 156 // the array literal and produces JSArray with those elements. |
157 // Additionally takes the literals array of the surrounding function | 157 // Additionally takes the literals array of the surrounding function |
158 // which contains the Array function to use for creating the array | 158 // which contains the Array function to use for creating the array |
159 // literal. | 159 // literal. |
160 ASSERT(args.length() == 2); | 160 ASSERT(args.length() == 2); |
161 CONVERT_CHECKED(FixedArray, elements, args[0]); | 161 CONVERT_CHECKED(FixedArray, elements, args[0]); |
162 | |
163 #ifdef USE_OLD_CALLING_CONVENTIONS | |
164 ASSERT(args[1]->IsTheHole()); | |
165 // TODO(1332579): Pass in the literals array from the function once | |
166 // the new calling convention is in place on ARM. Currently, we | |
167 // retrieve the array constructor from the global context. This is | |
168 // a security problem since the global object might have been | |
169 // reinitialized and the array constructor from the global context | |
170 // might be from a context that we are not allowed to access. | |
171 JSFunction* constructor = | |
172 JSFunction::cast(Top::context()->global_context()->array_function()); | |
173 #else | |
174 CONVERT_CHECKED(FixedArray, literals, args[1]); | 162 CONVERT_CHECKED(FixedArray, literals, args[1]); |
175 const int kArrayFunIndex = JSFunction::kLiteralArrayFunctionIndex; | 163 const int kArrayFunIndex = JSFunction::kLiteralArrayFunctionIndex; |
176 JSFunction* constructor = JSFunction::cast(literals->get(kArrayFunIndex)); | 164 JSFunction* constructor = JSFunction::cast(literals->get(kArrayFunIndex)); |
177 #endif | |
178 | 165 |
179 // Create the JSArray. | 166 // Create the JSArray. |
180 Object* object = Heap::AllocateJSObject(constructor); | 167 Object* object = Heap::AllocateJSObject(constructor); |
181 if (object->IsFailure()) return object; | 168 if (object->IsFailure()) return object; |
182 | 169 |
183 // Copy the elements. | 170 // Copy the elements. |
184 Object* content = elements->Copy(); | 171 Object* content = elements->Copy(); |
185 if (content->IsFailure()) return content; | 172 if (content->IsFailure()) return content; |
186 | 173 |
187 // Set the elements. | 174 // Set the elements. |
(...skipping 4790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4978 | 4965 |
4979 void Runtime::PerformGC(Object* result) { | 4966 void Runtime::PerformGC(Object* result) { |
4980 Failure* failure = Failure::cast(result); | 4967 Failure* failure = Failure::cast(result); |
4981 // Try to do a garbage collection; ignore it if it fails. The C | 4968 // Try to do a garbage collection; ignore it if it fails. The C |
4982 // entry stub will throw an out-of-memory exception in that case. | 4969 // entry stub will throw an out-of-memory exception in that case. |
4983 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); | 4970 Heap::CollectGarbage(failure->requested(), failure->allocation_space()); |
4984 } | 4971 } |
4985 | 4972 |
4986 | 4973 |
4987 } } // namespace v8::internal | 4974 } } // namespace v8::internal |
OLD | NEW |