OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 511 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
522 int new_length = len - 1; | 522 int new_length = len - 1; |
523 MaybeHandle<Object> maybe_element; | 523 MaybeHandle<Object> maybe_element; |
524 if (accessor->HasElement(array, array, new_length, elms_obj)) { | 524 if (accessor->HasElement(array, array, new_length, elms_obj)) { |
525 maybe_element = accessor->Get(array, array, new_length, elms_obj); | 525 maybe_element = accessor->Get(array, array, new_length, elms_obj); |
526 } else { | 526 } else { |
527 Handle<Object> proto(array->GetPrototype(), isolate); | 527 Handle<Object> proto(array->GetPrototype(), isolate); |
528 maybe_element = Object::GetElement(isolate, proto, len - 1); | 528 maybe_element = Object::GetElement(isolate, proto, len - 1); |
529 } | 529 } |
530 Handle<Object> element; | 530 Handle<Object> element; |
531 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, element, maybe_element); | 531 ASSIGN_RETURN_FAILURE_ON_EXCEPTION(isolate, element, maybe_element); |
532 RETURN_IF_EMPTY_HANDLE( | 532 RETURN_FAILURE_ON_EXCEPTION( |
533 isolate, | 533 isolate, |
534 accessor->SetLength(array, handle(Smi::FromInt(new_length), isolate))); | 534 accessor->SetLength(array, handle(Smi::FromInt(new_length), isolate))); |
535 return *element; | 535 return *element; |
536 } | 536 } |
537 | 537 |
538 | 538 |
539 BUILTIN(ArrayShift) { | 539 BUILTIN(ArrayShift) { |
540 HandleScope scope(isolate); | 540 HandleScope scope(isolate); |
541 Heap* heap = isolate->heap(); | 541 Heap* heap = isolate->heap(); |
542 Handle<Object> receiver = args.receiver(); | 542 Handle<Object> receiver = args.receiver(); |
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1224 is_construct); | 1224 is_construct); |
1225 | 1225 |
1226 v8::Handle<v8::Value> value = custom.Call(callback); | 1226 v8::Handle<v8::Value> value = custom.Call(callback); |
1227 if (value.IsEmpty()) { | 1227 if (value.IsEmpty()) { |
1228 result = heap->undefined_value(); | 1228 result = heap->undefined_value(); |
1229 } else { | 1229 } else { |
1230 result = *reinterpret_cast<Object**>(*value); | 1230 result = *reinterpret_cast<Object**>(*value); |
1231 result->VerifyApiCallResultType(); | 1231 result->VerifyApiCallResultType(); |
1232 } | 1232 } |
1233 | 1233 |
1234 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1234 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
1235 if (!is_construct || result->IsJSObject()) return result; | 1235 if (!is_construct || result->IsJSObject()) return result; |
1236 } | 1236 } |
1237 | 1237 |
1238 return *args.receiver(); | 1238 return *args.receiver(); |
1239 } | 1239 } |
1240 | 1240 |
1241 | 1241 |
1242 BUILTIN(HandleApiCall) { | 1242 BUILTIN(HandleApiCall) { |
1243 return HandleApiCallHelper<false>(args, isolate); | 1243 return HandleApiCallHelper<false>(args, isolate); |
1244 } | 1244 } |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1294 is_construct_call); | 1294 is_construct_call); |
1295 v8::Handle<v8::Value> value = custom.Call(callback); | 1295 v8::Handle<v8::Value> value = custom.Call(callback); |
1296 if (value.IsEmpty()) { | 1296 if (value.IsEmpty()) { |
1297 result = heap->undefined_value(); | 1297 result = heap->undefined_value(); |
1298 } else { | 1298 } else { |
1299 result = *reinterpret_cast<Object**>(*value); | 1299 result = *reinterpret_cast<Object**>(*value); |
1300 result->VerifyApiCallResultType(); | 1300 result->VerifyApiCallResultType(); |
1301 } | 1301 } |
1302 } | 1302 } |
1303 // Check for exceptions and return result. | 1303 // Check for exceptions and return result. |
1304 RETURN_IF_SCHEDULED_EXCEPTION(isolate); | 1304 RETURN_FAILURE_IF_SCHEDULED_EXCEPTION(isolate); |
1305 return result; | 1305 return result; |
1306 } | 1306 } |
1307 | 1307 |
1308 | 1308 |
1309 // Handle calls to non-function objects created through the API. This delegate | 1309 // Handle calls to non-function objects created through the API. This delegate |
1310 // function is used when the call is a normal function call. | 1310 // function is used when the call is a normal function call. |
1311 BUILTIN(HandleApiCallAsFunction) { | 1311 BUILTIN(HandleApiCallAsFunction) { |
1312 return HandleApiCallAsFunctionOrConstructor(isolate, false, args); | 1312 return HandleApiCallAsFunctionOrConstructor(isolate, false, args); |
1313 } | 1313 } |
1314 | 1314 |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 } | 1734 } |
1735 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1735 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1736 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1736 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1737 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1737 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1738 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1738 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1739 #undef DEFINE_BUILTIN_ACCESSOR_C | 1739 #undef DEFINE_BUILTIN_ACCESSOR_C |
1740 #undef DEFINE_BUILTIN_ACCESSOR_A | 1740 #undef DEFINE_BUILTIN_ACCESSOR_A |
1741 | 1741 |
1742 | 1742 |
1743 } } // namespace v8::internal | 1743 } } // namespace v8::internal |
OLD | NEW |