| 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 1446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1457 JSArray* result = JSArray::cast(args[0]); | 1457 JSArray* result = JSArray::cast(args[0]); |
| 1458 // Arguments to RegExpCloneResult should always be fresh RegExp exec call | 1458 // Arguments to RegExpCloneResult should always be fresh RegExp exec call |
| 1459 // results (either a fresh JSRegExpResult or null). | 1459 // results (either a fresh JSRegExpResult or null). |
| 1460 // If the argument is not a JSRegExpResult, or isn't unmodified, just return | 1460 // If the argument is not a JSRegExpResult, or isn't unmodified, just return |
| 1461 // the argument uncloned. | 1461 // the argument uncloned. |
| 1462 if (result->map() != regexp_result_map) return result; | 1462 if (result->map() != regexp_result_map) return result; |
| 1463 | 1463 |
| 1464 // Having the original JSRegExpResult map guarantees that we have | 1464 // Having the original JSRegExpResult map guarantees that we have |
| 1465 // fast elements and no properties except the two in-object properties. | 1465 // fast elements and no properties except the two in-object properties. |
| 1466 ASSERT(result->HasFastElements()); | 1466 ASSERT(result->HasFastElements()); |
| 1467 ASSERT(result->properties() == HEAP->empty_fixed_array()); | 1467 ASSERT(result->properties() == isolate->heap()->empty_fixed_array()); |
| 1468 ASSERT_EQ(2, regexp_result_map->inobject_properties()); | 1468 ASSERT_EQ(2, regexp_result_map->inobject_properties()); |
| 1469 | 1469 |
| 1470 Object* new_array_alloc = HEAP->AllocateRaw(JSRegExpResult::kSize, | 1470 Object* new_array_alloc = isolate->heap()->AllocateRaw(JSRegExpResult::kSize, |
| 1471 NEW_SPACE, | 1471 NEW_SPACE, |
| 1472 OLD_POINTER_SPACE); | 1472 OLD_POINTER_SPACE); |
| 1473 if (new_array_alloc->IsFailure()) return new_array_alloc; | 1473 if (new_array_alloc->IsFailure()) return new_array_alloc; |
| 1474 | 1474 |
| 1475 // Set HeapObject map to JSRegExpResult map. | 1475 // Set HeapObject map to JSRegExpResult map. |
| 1476 reinterpret_cast<HeapObject*>(new_array_alloc)->set_map(regexp_result_map); | 1476 reinterpret_cast<HeapObject*>(new_array_alloc)->set_map(regexp_result_map); |
| 1477 | 1477 |
| 1478 JSArray* new_array = JSArray::cast(new_array_alloc); | 1478 JSArray* new_array = JSArray::cast(new_array_alloc); |
| 1479 | 1479 |
| 1480 // Copy JSObject properties. | 1480 // Copy JSObject properties. |
| 1481 new_array->set_properties(result->properties()); // Empty FixedArray. | 1481 new_array->set_properties(result->properties()); // Empty FixedArray. |
| 1482 | 1482 |
| 1483 // Copy JSObject elements as copy-on-write. | 1483 // Copy JSObject elements as copy-on-write. |
| 1484 FixedArray* elements = FixedArray::cast(result->elements()); | 1484 FixedArray* elements = FixedArray::cast(result->elements()); |
| 1485 if (elements != HEAP->empty_fixed_array()) { | 1485 if (elements != isolate->heap()->empty_fixed_array()) { |
| 1486 elements->set_map(HEAP->fixed_cow_array_map()); | 1486 elements->set_map(isolate->heap()->fixed_cow_array_map()); |
| 1487 } | 1487 } |
| 1488 new_array->set_elements(elements); | 1488 new_array->set_elements(elements); |
| 1489 | 1489 |
| 1490 // Copy JSArray length. | 1490 // Copy JSArray length. |
| 1491 new_array->set_length(result->length()); | 1491 new_array->set_length(result->length()); |
| 1492 | 1492 |
| 1493 // Copy JSRegExpResult in-object property fields input and index. | 1493 // Copy JSRegExpResult in-object property fields input and index. |
| 1494 new_array->FastPropertyAtPut(JSRegExpResult::kIndexIndex, | 1494 new_array->FastPropertyAtPut(JSRegExpResult::kIndexIndex, |
| 1495 result->FastPropertyAt( | 1495 result->FastPropertyAt( |
| 1496 JSRegExpResult::kIndexIndex)); | 1496 JSRegExpResult::kIndexIndex)); |
| (...skipping 4925 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6422 RUNTIME_GET_ISOLATE; | 6422 RUNTIME_GET_ISOLATE; |
| 6423 NoHandleAllocation ha; | 6423 NoHandleAllocation ha; |
| 6424 ASSERT(args.length() == 2); | 6424 ASSERT(args.length() == 2); |
| 6425 | 6425 |
| 6426 CONVERT_DOUBLE_CHECKED(t, args[0]); | 6426 CONVERT_DOUBLE_CHECKED(t, args[0]); |
| 6427 CONVERT_CHECKED(JSArray, res_array, args[1]); | 6427 CONVERT_CHECKED(JSArray, res_array, args[1]); |
| 6428 | 6428 |
| 6429 int year, month, day; | 6429 int year, month, day; |
| 6430 DateYMDFromTime(static_cast<int>(floor(t / 86400000)), year, month, day); | 6430 DateYMDFromTime(static_cast<int>(floor(t / 86400000)), year, month, day); |
| 6431 | 6431 |
| 6432 RUNTIME_ASSERT(res_array->elements()->map() == HEAP->fixed_array_map()); | 6432 RUNTIME_ASSERT(res_array->elements()->map() == |
| 6433 isolate->heap()->fixed_array_map()); |
| 6433 FixedArray* elms = FixedArray::cast(res_array->elements()); | 6434 FixedArray* elms = FixedArray::cast(res_array->elements()); |
| 6434 RUNTIME_ASSERT(elms->length() == 3); | 6435 RUNTIME_ASSERT(elms->length() == 3); |
| 6435 | 6436 |
| 6436 elms->set(0, Smi::FromInt(year)); | 6437 elms->set(0, Smi::FromInt(year)); |
| 6437 elms->set(1, Smi::FromInt(month)); | 6438 elms->set(1, Smi::FromInt(month)); |
| 6438 elms->set(2, Smi::FromInt(day)); | 6439 elms->set(2, Smi::FromInt(day)); |
| 6439 | 6440 |
| 6440 return isolate->heap()->undefined_value(); | 6441 return isolate->heap()->undefined_value(); |
| 6441 } | 6442 } |
| 6442 | 6443 |
| (...skipping 1427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7870 | 7871 |
| 7871 | 7872 |
| 7872 // Move contents of argument 0 (an array) to argument 1 (an array) | 7873 // Move contents of argument 0 (an array) to argument 1 (an array) |
| 7873 static Object* Runtime_MoveArrayContents(RUNTIME_CALLING_CONVENTION) { | 7874 static Object* Runtime_MoveArrayContents(RUNTIME_CALLING_CONVENTION) { |
| 7874 RUNTIME_GET_ISOLATE; | 7875 RUNTIME_GET_ISOLATE; |
| 7875 ASSERT(args.length() == 2); | 7876 ASSERT(args.length() == 2); |
| 7876 CONVERT_CHECKED(JSArray, from, args[0]); | 7877 CONVERT_CHECKED(JSArray, from, args[0]); |
| 7877 CONVERT_CHECKED(JSArray, to, args[1]); | 7878 CONVERT_CHECKED(JSArray, to, args[1]); |
| 7878 HeapObject* new_elements = from->elements(); | 7879 HeapObject* new_elements = from->elements(); |
| 7879 Object* new_map; | 7880 Object* new_map; |
| 7880 if (new_elements->map() == HEAP->fixed_array_map() || | 7881 if (new_elements->map() == isolate->heap()->fixed_array_map() || |
| 7881 new_elements->map() == HEAP->fixed_cow_array_map()) { | 7882 new_elements->map() == isolate->heap()->fixed_cow_array_map()) { |
| 7882 new_map = to->map()->GetFastElementsMap(); | 7883 new_map = to->map()->GetFastElementsMap(); |
| 7883 } else { | 7884 } else { |
| 7884 new_map = to->map()->GetSlowElementsMap(); | 7885 new_map = to->map()->GetSlowElementsMap(); |
| 7885 } | 7886 } |
| 7886 if (new_map->IsFailure()) return new_map; | 7887 if (new_map->IsFailure()) return new_map; |
| 7887 to->set_map(Map::cast(new_map)); | 7888 to->set_map(Map::cast(new_map)); |
| 7888 to->set_elements(new_elements); | 7889 to->set_elements(new_elements); |
| 7889 to->set_length(from->length()); | 7890 to->set_length(from->length()); |
| 7890 Object* obj = from->ResetElements(); | 7891 Object* obj = from->ResetElements(); |
| 7891 if (obj->IsFailure()) return obj; | 7892 if (obj->IsFailure()) return obj; |
| (...skipping 2733 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10625 #define SETUP_RUNTIME_ENTRIES(Name, argc, resize) \ | 10626 #define SETUP_RUNTIME_ENTRIES(Name, argc, resize) \ |
| 10626 entries_[lut_index].method = &CodeGenerator::Generate##Name; \ | 10627 entries_[lut_index].method = &CodeGenerator::Generate##Name; \ |
| 10627 entries_[lut_index].name = "_" #Name; \ | 10628 entries_[lut_index].name = "_" #Name; \ |
| 10628 entries_[lut_index++].nargs = argc; | 10629 entries_[lut_index++].nargs = argc; |
| 10629 INLINE_RUNTIME_FUNCTION_LIST(SETUP_RUNTIME_ENTRIES); | 10630 INLINE_RUNTIME_FUNCTION_LIST(SETUP_RUNTIME_ENTRIES); |
| 10630 #undef SETUP_RUNTIME_ENTRIES | 10631 #undef SETUP_RUNTIME_ENTRIES |
| 10631 } | 10632 } |
| 10632 | 10633 |
| 10633 | 10634 |
| 10634 } } // namespace v8::internal | 10635 } } // namespace v8::internal |
| OLD | NEW |