| OLD | NEW |
| 1 // Copyright 2006-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2009 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 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1235 HandleScope scope; | 1235 HandleScope scope; |
| 1236 ASSERT(args.length() == 1); | 1236 ASSERT(args.length() == 1); |
| 1237 CONVERT_ARG_CHECKED(JSArray, prototype, 0); | 1237 CONVERT_ARG_CHECKED(JSArray, prototype, 0); |
| 1238 // This is necessary to enable fast checks for absence of elements | 1238 // This is necessary to enable fast checks for absence of elements |
| 1239 // on Array.prototype and below. | 1239 // on Array.prototype and below. |
| 1240 prototype->set_elements(Heap::empty_fixed_array()); | 1240 prototype->set_elements(Heap::empty_fixed_array()); |
| 1241 return Smi::FromInt(0); | 1241 return Smi::FromInt(0); |
| 1242 } | 1242 } |
| 1243 | 1243 |
| 1244 | 1244 |
| 1245 static Handle<JSFunction> InstallFunction(Handle<JSObject> holder, |
| 1246 const char* name, |
| 1247 Builtins::Name builtin_name) { |
| 1248 Handle<String> key = Factory::LookupAsciiSymbol(name); |
| 1249 Handle<Code> code(Builtins::builtin(builtin_name)); |
| 1250 Handle<JSFunction> optimized = Factory::NewFunction(key, |
| 1251 JS_OBJECT_TYPE, |
| 1252 JSObject::kHeaderSize, |
| 1253 code, |
| 1254 false); |
| 1255 optimized->shared()->DontAdaptArguments(); |
| 1256 SetProperty(holder, key, optimized, NONE); |
| 1257 return optimized; |
| 1258 } |
| 1259 |
| 1260 |
| 1261 static Object* Runtime_SpecialArrayFunctions(Arguments args) { |
| 1262 HandleScope scope; |
| 1263 ASSERT(args.length() == 1); |
| 1264 CONVERT_ARG_CHECKED(JSObject, holder, 0); |
| 1265 |
| 1266 InstallFunction(holder, "pop", Builtins::ArrayPop); |
| 1267 InstallFunction(holder, "push", Builtins::ArrayPush); |
| 1268 InstallFunction(holder, "shift", Builtins::ArrayShift); |
| 1269 InstallFunction(holder, "unshift", Builtins::ArrayUnshift); |
| 1270 InstallFunction(holder, "slice", Builtins::ArraySlice); |
| 1271 InstallFunction(holder, "splice", Builtins::ArraySplice); |
| 1272 |
| 1273 return *holder; |
| 1274 } |
| 1275 |
| 1276 |
| 1245 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { | 1277 static Object* Runtime_MaterializeRegExpLiteral(Arguments args) { |
| 1246 HandleScope scope; | 1278 HandleScope scope; |
| 1247 ASSERT(args.length() == 4); | 1279 ASSERT(args.length() == 4); |
| 1248 CONVERT_ARG_CHECKED(FixedArray, literals, 0); | 1280 CONVERT_ARG_CHECKED(FixedArray, literals, 0); |
| 1249 int index = Smi::cast(args[1])->value(); | 1281 int index = Smi::cast(args[1])->value(); |
| 1250 Handle<String> pattern = args.at<String>(2); | 1282 Handle<String> pattern = args.at<String>(2); |
| 1251 Handle<String> flags = args.at<String>(3); | 1283 Handle<String> flags = args.at<String>(3); |
| 1252 | 1284 |
| 1253 // Get the RegExp function from the context in the literals array. | 1285 // Get the RegExp function from the context in the literals array. |
| 1254 // This is the RegExp function from the context in which the | 1286 // This is the RegExp function from the context in which the |
| (...skipping 7456 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8711 } else { | 8743 } else { |
| 8712 // Handle last resort GC and make sure to allow future allocations | 8744 // Handle last resort GC and make sure to allow future allocations |
| 8713 // to grow the heap without causing GCs (if possible). | 8745 // to grow the heap without causing GCs (if possible). |
| 8714 Counters::gc_last_resort_from_js.Increment(); | 8746 Counters::gc_last_resort_from_js.Increment(); |
| 8715 Heap::CollectAllGarbage(false); | 8747 Heap::CollectAllGarbage(false); |
| 8716 } | 8748 } |
| 8717 } | 8749 } |
| 8718 | 8750 |
| 8719 | 8751 |
| 8720 } } // namespace v8::internal | 8752 } } // namespace v8::internal |
| OLD | NEW |