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 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
670 if (array->HasFastElements()) { | 670 if (array->HasFastElements()) { |
671 elms = array->elements(); | 671 elms = array->elements(); |
672 } else { | 672 } else { |
673 return CallJsBuiltin(isolate, "ArraySlice", args); | 673 return CallJsBuiltin(isolate, "ArraySlice", args); |
674 } | 674 } |
675 | 675 |
676 len = Smi::cast(array->length())->value(); | 676 len = Smi::cast(array->length())->value(); |
677 } else { | 677 } else { |
678 // Array.slice(arguments, ...) is quite a common idiom (notably more | 678 // Array.slice(arguments, ...) is quite a common idiom (notably more |
679 // than 50% of invocations in Web apps). Treat it in C++ as well. | 679 // than 50% of invocations in Web apps). Treat it in C++ as well. |
680 Map* arguments_map = | 680 Map* arguments_map = isolate->context()->native_context()-> |
681 isolate->context()->native_context()->arguments_boilerplate()->map(); | 681 sloppy_arguments_boilerplate()->map(); |
682 | 682 |
683 bool is_arguments_object_with_fast_elements = | 683 bool is_arguments_object_with_fast_elements = |
684 receiver->IsJSObject() && | 684 receiver->IsJSObject() && |
685 JSObject::cast(receiver)->map() == arguments_map; | 685 JSObject::cast(receiver)->map() == arguments_map; |
686 if (!is_arguments_object_with_fast_elements) { | 686 if (!is_arguments_object_with_fast_elements) { |
687 return CallJsBuiltin(isolate, "ArraySlice", args); | 687 return CallJsBuiltin(isolate, "ArraySlice", args); |
688 } | 688 } |
689 JSObject* object = JSObject::cast(receiver); | 689 JSObject* object = JSObject::cast(receiver); |
690 | 690 |
691 if (object->HasFastElements()) { | 691 if (object->HasFastElements()) { |
(...skipping 475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1167 Handle<FunctionTemplateInfo> desc(fun_data, isolate); | 1167 Handle<FunctionTemplateInfo> desc(fun_data, isolate); |
1168 bool pending_exception = false; | 1168 bool pending_exception = false; |
1169 isolate->factory()->ConfigureInstance( | 1169 isolate->factory()->ConfigureInstance( |
1170 desc, Handle<JSObject>::cast(args.receiver()), &pending_exception); | 1170 desc, Handle<JSObject>::cast(args.receiver()), &pending_exception); |
1171 ASSERT(isolate->has_pending_exception() == pending_exception); | 1171 ASSERT(isolate->has_pending_exception() == pending_exception); |
1172 if (pending_exception) return Failure::Exception(); | 1172 if (pending_exception) return Failure::Exception(); |
1173 fun_data = *desc; | 1173 fun_data = *desc; |
1174 } | 1174 } |
1175 | 1175 |
1176 SharedFunctionInfo* shared = function->shared(); | 1176 SharedFunctionInfo* shared = function->shared(); |
1177 if (shared->is_sloppy_mode() && !shared->native()) { | 1177 if (shared->strict_mode() == SLOPPY && !shared->native()) { |
1178 Object* recv = args[0]; | 1178 Object* recv = args[0]; |
1179 ASSERT(!recv->IsNull()); | 1179 ASSERT(!recv->IsNull()); |
1180 if (recv->IsUndefined()) { | 1180 if (recv->IsUndefined()) { |
1181 args[0] = function->context()->global_object()->global_receiver(); | 1181 args[0] = function->context()->global_object()->global_receiver(); |
1182 } | 1182 } |
1183 } | 1183 } |
1184 | 1184 |
1185 Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data); | 1185 Object* raw_holder = TypeCheck(heap, args.length(), &args[0], fun_data); |
1186 | 1186 |
1187 if (raw_holder->IsNull()) { | 1187 if (raw_holder->IsNull()) { |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 } | 1386 } |
1387 | 1387 |
1388 | 1388 |
1389 static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { | 1389 static void Generate_StoreIC_Setter_ForDeopt(MacroAssembler* masm) { |
1390 StoreStubCompiler::GenerateStoreViaSetter( | 1390 StoreStubCompiler::GenerateStoreViaSetter( |
1391 masm, Handle<HeapType>::null(), Handle<JSFunction>()); | 1391 masm, Handle<HeapType>::null(), Handle<JSFunction>()); |
1392 } | 1392 } |
1393 | 1393 |
1394 | 1394 |
1395 static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) { | 1395 static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) { |
1396 KeyedStoreIC::GenerateGeneric(masm, kSloppyMode); | 1396 KeyedStoreIC::GenerateGeneric(masm, SLOPPY); |
1397 } | 1397 } |
1398 | 1398 |
1399 | 1399 |
1400 static void Generate_KeyedStoreIC_Generic_Strict(MacroAssembler* masm) { | 1400 static void Generate_KeyedStoreIC_Generic_Strict(MacroAssembler* masm) { |
1401 KeyedStoreIC::GenerateGeneric(masm, kStrictMode); | 1401 KeyedStoreIC::GenerateGeneric(masm, STRICT); |
1402 } | 1402 } |
1403 | 1403 |
1404 | 1404 |
1405 static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { | 1405 static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { |
1406 KeyedStoreIC::GenerateMiss(masm); | 1406 KeyedStoreIC::GenerateMiss(masm); |
1407 } | 1407 } |
1408 | 1408 |
1409 | 1409 |
1410 static void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { | 1410 static void Generate_KeyedStoreIC_Slow(MacroAssembler* masm) { |
1411 KeyedStoreIC::GenerateSlow(masm); | 1411 KeyedStoreIC::GenerateSlow(masm); |
(...skipping 329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1741 } | 1741 } |
1742 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) | 1742 BUILTIN_LIST_C(DEFINE_BUILTIN_ACCESSOR_C) |
1743 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) | 1743 BUILTIN_LIST_A(DEFINE_BUILTIN_ACCESSOR_A) |
1744 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) | 1744 BUILTIN_LIST_H(DEFINE_BUILTIN_ACCESSOR_H) |
1745 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) | 1745 BUILTIN_LIST_DEBUG_A(DEFINE_BUILTIN_ACCESSOR_A) |
1746 #undef DEFINE_BUILTIN_ACCESSOR_C | 1746 #undef DEFINE_BUILTIN_ACCESSOR_C |
1747 #undef DEFINE_BUILTIN_ACCESSOR_A | 1747 #undef DEFINE_BUILTIN_ACCESSOR_A |
1748 | 1748 |
1749 | 1749 |
1750 } } // namespace v8::internal | 1750 } } // namespace v8::internal |
OLD | NEW |