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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
208 // Copy the elements. | 208 // Copy the elements. |
209 Object* content = elements->Copy(); | 209 Object* content = elements->Copy(); |
210 if (content->IsFailure()) return content; | 210 if (content->IsFailure()) return content; |
211 | 211 |
212 // Set the elements. | 212 // Set the elements. |
213 JSArray::cast(object)->SetContent(FixedArray::cast(content)); | 213 JSArray::cast(object)->SetContent(FixedArray::cast(content)); |
214 return object; | 214 return object; |
215 } | 215 } |
216 | 216 |
217 | 217 |
| 218 static Object* Runtime_CreateCatchExtensionObject(Arguments args) { |
| 219 ASSERT(args.length() == 2); |
| 220 CONVERT_CHECKED(String, key, args[0]); |
| 221 Object* value = args[1]; |
| 222 // Create a catch context extension object. |
| 223 JSFunction* constructor = |
| 224 Top::context()->global_context()->context_extension_function(); |
| 225 Object* object = Heap::AllocateJSObject(constructor); |
| 226 if (object->IsFailure()) return object; |
| 227 // Assign the exception value to the catch variable and make sure |
| 228 // that the catch variable is DontDelete. |
| 229 value = JSObject::cast(object)->SetProperty(key, value, DONT_DELETE); |
| 230 if (value->IsFailure()) return value; |
| 231 return object; |
| 232 } |
| 233 |
| 234 |
218 static Object* Runtime_ClassOf(Arguments args) { | 235 static Object* Runtime_ClassOf(Arguments args) { |
219 NoHandleAllocation ha; | 236 NoHandleAllocation ha; |
220 ASSERT(args.length() == 1); | 237 ASSERT(args.length() == 1); |
221 Object* obj = args[0]; | 238 Object* obj = args[0]; |
222 if (!obj->IsJSObject()) return Heap::null_value(); | 239 if (!obj->IsJSObject()) return Heap::null_value(); |
223 return JSObject::cast(obj)->class_name(); | 240 return JSObject::cast(obj)->class_name(); |
224 } | 241 } |
225 | 242 |
226 | 243 |
227 static Object* Runtime_HasStringClass(Arguments args) { | 244 static Object* Runtime_HasStringClass(Arguments args) { |
(...skipping 5716 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5944 } else { | 5961 } else { |
5945 // Handle last resort GC and make sure to allow future allocations | 5962 // Handle last resort GC and make sure to allow future allocations |
5946 // to grow the heap without causing GCs (if possible). | 5963 // to grow the heap without causing GCs (if possible). |
5947 Counters::gc_last_resort_from_js.Increment(); | 5964 Counters::gc_last_resort_from_js.Increment(); |
5948 Heap::CollectAllGarbage(); | 5965 Heap::CollectAllGarbage(); |
5949 } | 5966 } |
5950 } | 5967 } |
5951 | 5968 |
5952 | 5969 |
5953 } } // namespace v8::internal | 5970 } } // namespace v8::internal |
OLD | NEW |