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 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1201 ASSERT(args.length() == 2); | 1201 ASSERT(args.length() == 2); |
1202 CONVERT_ARG_CHECKED(JSObject, object, 0); | 1202 CONVERT_ARG_CHECKED(JSObject, object, 0); |
1203 CONVERT_SMI_CHECKED(properties, args[1]); | 1203 CONVERT_SMI_CHECKED(properties, args[1]); |
1204 if (object->HasFastProperties()) { | 1204 if (object->HasFastProperties()) { |
1205 NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties); | 1205 NormalizeProperties(object, KEEP_INOBJECT_PROPERTIES, properties); |
1206 } | 1206 } |
1207 return *object; | 1207 return *object; |
1208 } | 1208 } |
1209 | 1209 |
1210 | 1210 |
1211 static Object* Runtime_TransformToFastProperties(Arguments args) { | |
1212 HandleScope scope; | |
1213 ASSERT(args.length() == 1); | |
1214 CONVERT_ARG_CHECKED(JSObject, object, 0); | |
1215 if (!object->HasFastProperties() && !object->IsGlobalObject()) { | |
1216 TransformToFastProperties(object, 0); | |
1217 } | |
1218 return *object; | |
1219 } | |
1220 | |
1221 | |
1222 static Object* Runtime_RegExpExec(Arguments args) { | 1211 static Object* Runtime_RegExpExec(Arguments args) { |
1223 HandleScope scope; | 1212 HandleScope scope; |
1224 ASSERT(args.length() == 4); | 1213 ASSERT(args.length() == 4); |
1225 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); | 1214 CONVERT_ARG_CHECKED(JSRegExp, regexp, 0); |
1226 CONVERT_ARG_CHECKED(String, subject, 1); | 1215 CONVERT_ARG_CHECKED(String, subject, 1); |
1227 // Due to the way the JS calls are constructed this must be less than the | 1216 // Due to the way the JS calls are constructed this must be less than the |
1228 // length of a string, i.e. it is always a Smi. We check anyway for security. | 1217 // length of a string, i.e. it is always a Smi. We check anyway for security. |
1229 CONVERT_SMI_CHECKED(index, args[2]); | 1218 CONVERT_SMI_CHECKED(index, args[2]); |
1230 CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); | 1219 CONVERT_ARG_CHECKED(JSArray, last_match_info, 3); |
1231 RUNTIME_ASSERT(last_match_info->HasFastElements()); | 1220 RUNTIME_ASSERT(last_match_info->HasFastElements()); |
(...skipping 2281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3513 // Handle special arguments properties. | 3502 // Handle special arguments properties. |
3514 if (key->Equals(Heap::length_symbol())) return Smi::FromInt(n); | 3503 if (key->Equals(Heap::length_symbol())) return Smi::FromInt(n); |
3515 if (key->Equals(Heap::callee_symbol())) return frame->function(); | 3504 if (key->Equals(Heap::callee_symbol())) return frame->function(); |
3516 | 3505 |
3517 // Lookup in the initial Object.prototype object. | 3506 // Lookup in the initial Object.prototype object. |
3518 return Top::initial_object_prototype()->GetProperty(*key); | 3507 return Top::initial_object_prototype()->GetProperty(*key); |
3519 } | 3508 } |
3520 | 3509 |
3521 | 3510 |
3522 static Object* Runtime_ToFastProperties(Arguments args) { | 3511 static Object* Runtime_ToFastProperties(Arguments args) { |
| 3512 HandleScope scope; |
| 3513 |
3523 ASSERT(args.length() == 1); | 3514 ASSERT(args.length() == 1); |
3524 Handle<Object> object = args.at<Object>(0); | 3515 Handle<Object> object = args.at<Object>(0); |
3525 if (object->IsJSObject()) { | 3516 if (object->IsJSObject()) { |
3526 Handle<JSObject> js_object = Handle<JSObject>::cast(object); | 3517 Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
3527 js_object->TransformToFastProperties(0); | 3518 if (!js_object->HasFastProperties() && !js_object->IsGlobalObject()) { |
| 3519 js_object->TransformToFastProperties(0); |
| 3520 } |
3528 } | 3521 } |
3529 return *object; | 3522 return *object; |
3530 } | 3523 } |
3531 | 3524 |
3532 | 3525 |
3533 static Object* Runtime_ToSlowProperties(Arguments args) { | 3526 static Object* Runtime_ToSlowProperties(Arguments args) { |
| 3527 HandleScope scope; |
| 3528 |
3534 ASSERT(args.length() == 1); | 3529 ASSERT(args.length() == 1); |
3535 Handle<Object> object = args.at<Object>(0); | 3530 Handle<Object> object = args.at<Object>(0); |
3536 if (object->IsJSObject()) { | 3531 if (object->IsJSObject()) { |
3537 Handle<JSObject> js_object = Handle<JSObject>::cast(object); | 3532 Handle<JSObject> js_object = Handle<JSObject>::cast(object); |
3538 js_object->NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); | 3533 js_object->NormalizeProperties(CLEAR_INOBJECT_PROPERTIES, 0); |
3539 } | 3534 } |
3540 return *object; | 3535 return *object; |
3541 } | 3536 } |
3542 | 3537 |
3543 | 3538 |
(...skipping 4638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8182 } else { | 8177 } else { |
8183 // Handle last resort GC and make sure to allow future allocations | 8178 // Handle last resort GC and make sure to allow future allocations |
8184 // to grow the heap without causing GCs (if possible). | 8179 // to grow the heap without causing GCs (if possible). |
8185 Counters::gc_last_resort_from_js.Increment(); | 8180 Counters::gc_last_resort_from_js.Increment(); |
8186 Heap::CollectAllGarbage(false); | 8181 Heap::CollectAllGarbage(false); |
8187 } | 8182 } |
8188 } | 8183 } |
8189 | 8184 |
8190 | 8185 |
8191 } } // namespace v8::internal | 8186 } } // namespace v8::internal |
OLD | NEW |