| 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 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 125 // through the BuiltinArguments object args. | 125 // through the BuiltinArguments object args. |
| 126 | 126 |
| 127 #ifdef DEBUG | 127 #ifdef DEBUG |
| 128 | 128 |
| 129 #define BUILTIN(name) \ | 129 #define BUILTIN(name) \ |
| 130 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ | 130 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ |
| 131 name##ArgumentsType args, Isolate* isolate); \ | 131 name##ArgumentsType args, Isolate* isolate); \ |
| 132 MUST_USE_RESULT static MaybeObject* Builtin_##name( \ | 132 MUST_USE_RESULT static MaybeObject* Builtin_##name( \ |
| 133 int args_length, Object** args_object, Isolate* isolate) { \ | 133 int args_length, Object** args_object, Isolate* isolate) { \ |
| 134 name##ArgumentsType args(args_length, args_object); \ | 134 name##ArgumentsType args(args_length, args_object); \ |
| 135 ASSERT(isolate == Isolate::Current()); \ | |
| 136 args.Verify(); \ | 135 args.Verify(); \ |
| 137 return Builtin_Impl_##name(args, isolate); \ | 136 return Builtin_Impl_##name(args, isolate); \ |
| 138 } \ | 137 } \ |
| 139 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ | 138 MUST_USE_RESULT static MaybeObject* Builtin_Impl_##name( \ |
| 140 name##ArgumentsType args, Isolate* isolate) | 139 name##ArgumentsType args, Isolate* isolate) |
| 141 | 140 |
| 142 #else // For release mode. | 141 #else // For release mode. |
| 143 | 142 |
| 144 #define BUILTIN(name) \ | 143 #define BUILTIN(name) \ |
| 145 static MaybeObject* Builtin_impl##name( \ | 144 static MaybeObject* Builtin_impl##name( \ |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 441 Handle<Object> js_builtin = | 440 Handle<Object> js_builtin = |
| 442 GetProperty(Handle<JSObject>(isolate->native_context()->builtins()), | 441 GetProperty(Handle<JSObject>(isolate->native_context()->builtins()), |
| 443 name); | 442 name); |
| 444 Handle<JSFunction> function = Handle<JSFunction>::cast(js_builtin); | 443 Handle<JSFunction> function = Handle<JSFunction>::cast(js_builtin); |
| 445 int argc = args.length() - 1; | 444 int argc = args.length() - 1; |
| 446 ScopedVector<Handle<Object> > argv(argc); | 445 ScopedVector<Handle<Object> > argv(argc); |
| 447 for (int i = 0; i < argc; ++i) { | 446 for (int i = 0; i < argc; ++i) { |
| 448 argv[i] = args.at<Object>(i + 1); | 447 argv[i] = args.at<Object>(i + 1); |
| 449 } | 448 } |
| 450 bool pending_exception; | 449 bool pending_exception; |
| 451 Handle<Object> result = Execution::Call(function, | 450 Handle<Object> result = Execution::Call(isolate, |
| 451 function, |
| 452 args.receiver(), | 452 args.receiver(), |
| 453 argc, | 453 argc, |
| 454 argv.start(), | 454 argv.start(), |
| 455 &pending_exception); | 455 &pending_exception); |
| 456 if (pending_exception) return Failure::Exception(); | 456 if (pending_exception) return Failure::Exception(); |
| 457 return *result; | 457 return *result; |
| 458 } | 458 } |
| 459 | 459 |
| 460 | 460 |
| 461 BUILTIN(ArrayPush) { | 461 BUILTIN(ArrayPush) { |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 587 | 587 |
| 588 int len = Smi::cast(array->length())->value(); | 588 int len = Smi::cast(array->length())->value(); |
| 589 if (len == 0) return heap->undefined_value(); | 589 if (len == 0) return heap->undefined_value(); |
| 590 | 590 |
| 591 ElementsAccessor* accessor = array->GetElementsAccessor(); | 591 ElementsAccessor* accessor = array->GetElementsAccessor(); |
| 592 int new_length = len - 1; | 592 int new_length = len - 1; |
| 593 MaybeObject* maybe_result; | 593 MaybeObject* maybe_result; |
| 594 if (accessor->HasElement(array, array, new_length, elms_obj)) { | 594 if (accessor->HasElement(array, array, new_length, elms_obj)) { |
| 595 maybe_result = accessor->Get(array, array, new_length, elms_obj); | 595 maybe_result = accessor->Get(array, array, new_length, elms_obj); |
| 596 } else { | 596 } else { |
| 597 maybe_result = array->GetPrototype()->GetElement(len - 1); | 597 maybe_result = array->GetPrototype()->GetElement(isolate, len - 1); |
| 598 } | 598 } |
| 599 if (maybe_result->IsFailure()) return maybe_result; | 599 if (maybe_result->IsFailure()) return maybe_result; |
| 600 MaybeObject* maybe_failure = | 600 MaybeObject* maybe_failure = |
| 601 accessor->SetLength(array, Smi::FromInt(new_length)); | 601 accessor->SetLength(array, Smi::FromInt(new_length)); |
| 602 if (maybe_failure->IsFailure()) return maybe_failure; | 602 if (maybe_failure->IsFailure()) return maybe_failure; |
| 603 return maybe_result; | 603 return maybe_result; |
| 604 } | 604 } |
| 605 | 605 |
| 606 | 606 |
| 607 BUILTIN(ArrayShift) { | 607 BUILTIN(ArrayShift) { |
| (...skipping 846 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1454 static void Generate_StoreIC_Initialize(MacroAssembler* masm) { | 1454 static void Generate_StoreIC_Initialize(MacroAssembler* masm) { |
| 1455 StoreIC::GenerateInitialize(masm); | 1455 StoreIC::GenerateInitialize(masm); |
| 1456 } | 1456 } |
| 1457 | 1457 |
| 1458 | 1458 |
| 1459 static void Generate_StoreIC_Initialize_Strict(MacroAssembler* masm) { | 1459 static void Generate_StoreIC_Initialize_Strict(MacroAssembler* masm) { |
| 1460 StoreIC::GenerateInitialize(masm); | 1460 StoreIC::GenerateInitialize(masm); |
| 1461 } | 1461 } |
| 1462 | 1462 |
| 1463 | 1463 |
| 1464 static void Generate_StoreIC_PreMonomorphic(MacroAssembler* masm) { |
| 1465 StoreIC::GeneratePreMonomorphic(masm); |
| 1466 } |
| 1467 |
| 1468 |
| 1469 static void Generate_StoreIC_PreMonomorphic_Strict(MacroAssembler* masm) { |
| 1470 StoreIC::GeneratePreMonomorphic(masm); |
| 1471 } |
| 1472 |
| 1473 |
| 1464 static void Generate_StoreIC_Miss(MacroAssembler* masm) { | 1474 static void Generate_StoreIC_Miss(MacroAssembler* masm) { |
| 1465 StoreIC::GenerateMiss(masm); | 1475 StoreIC::GenerateMiss(masm); |
| 1466 } | 1476 } |
| 1467 | 1477 |
| 1468 | 1478 |
| 1469 static void Generate_StoreIC_Normal(MacroAssembler* masm) { | 1479 static void Generate_StoreIC_Normal(MacroAssembler* masm) { |
| 1470 StoreIC::GenerateNormal(masm); | 1480 StoreIC::GenerateNormal(masm); |
| 1471 } | 1481 } |
| 1472 | 1482 |
| 1473 | 1483 |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1539 static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) { | 1549 static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) { |
| 1540 KeyedStoreIC::GenerateInitialize(masm); | 1550 KeyedStoreIC::GenerateInitialize(masm); |
| 1541 } | 1551 } |
| 1542 | 1552 |
| 1543 | 1553 |
| 1544 static void Generate_KeyedStoreIC_Initialize_Strict(MacroAssembler* masm) { | 1554 static void Generate_KeyedStoreIC_Initialize_Strict(MacroAssembler* masm) { |
| 1545 KeyedStoreIC::GenerateInitialize(masm); | 1555 KeyedStoreIC::GenerateInitialize(masm); |
| 1546 } | 1556 } |
| 1547 | 1557 |
| 1548 | 1558 |
| 1559 static void Generate_KeyedStoreIC_PreMonomorphic(MacroAssembler* masm) { |
| 1560 KeyedStoreIC::GeneratePreMonomorphic(masm); |
| 1561 } |
| 1562 |
| 1563 |
| 1564 static void Generate_KeyedStoreIC_PreMonomorphic_Strict(MacroAssembler* masm) { |
| 1565 KeyedStoreIC::GeneratePreMonomorphic(masm); |
| 1566 } |
| 1567 |
| 1568 |
| 1549 static void Generate_KeyedStoreIC_NonStrictArguments(MacroAssembler* masm) { | 1569 static void Generate_KeyedStoreIC_NonStrictArguments(MacroAssembler* masm) { |
| 1550 KeyedStoreIC::GenerateNonStrictArguments(masm); | 1570 KeyedStoreIC::GenerateNonStrictArguments(masm); |
| 1551 } | 1571 } |
| 1552 | 1572 |
| 1553 | 1573 |
| 1554 #ifdef ENABLE_DEBUGGER_SUPPORT | 1574 #ifdef ENABLE_DEBUGGER_SUPPORT |
| 1555 static void Generate_LoadIC_DebugBreak(MacroAssembler* masm) { | 1575 static void Generate_LoadIC_DebugBreak(MacroAssembler* masm) { |
| 1556 Debug::GenerateLoadICDebugBreak(masm); | 1576 Debug::GenerateLoadICDebugBreak(masm); |
| 1557 } | 1577 } |
| 1558 | 1578 |
| (...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1837 return Handle<Code>(code_address); \ | 1857 return Handle<Code>(code_address); \ |
| 1838 } | 1858 } |
| 1839 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1859 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
| 1840 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1860 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1841 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1861 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
| 1842 #undef DEFINE_BUILTIN_ACCESSOR_C | 1862 #undef DEFINE_BUILTIN_ACCESSOR_C |
| 1843 #undef DEFINE_BUILTIN_ACCESSOR_A | 1863 #undef DEFINE_BUILTIN_ACCESSOR_A |
| 1844 | 1864 |
| 1845 | 1865 |
| 1846 } } // namespace v8::internal | 1866 } } // namespace v8::internal |
| OLD | NEW |