| OLD | NEW |
| 1 // Copyright 2006-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2008 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 639 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 650 | 650 |
| 651 bool is_arguments_object_with_fast_elements = | 651 bool is_arguments_object_with_fast_elements = |
| 652 receiver->IsJSObject() | 652 receiver->IsJSObject() |
| 653 && JSObject::cast(receiver)->map() == arguments_map | 653 && JSObject::cast(receiver)->map() == arguments_map |
| 654 && JSObject::cast(receiver)->HasFastElements(); | 654 && JSObject::cast(receiver)->HasFastElements(); |
| 655 if (!is_arguments_object_with_fast_elements) { | 655 if (!is_arguments_object_with_fast_elements) { |
| 656 return CallJsBuiltin(isolate, "ArraySlice", args); | 656 return CallJsBuiltin(isolate, "ArraySlice", args); |
| 657 } | 657 } |
| 658 elms = FixedArray::cast(JSObject::cast(receiver)->elements()); | 658 elms = FixedArray::cast(JSObject::cast(receiver)->elements()); |
| 659 Object* len_obj = JSObject::cast(receiver) | 659 Object* len_obj = JSObject::cast(receiver) |
| 660 ->InObjectPropertyAt(Heap::arguments_length_index); | 660 ->InObjectPropertyAt(Heap::kArgumentsLengthIndex); |
| 661 if (!len_obj->IsSmi()) { | 661 if (!len_obj->IsSmi()) { |
| 662 return CallJsBuiltin(isolate, "ArraySlice", args); | 662 return CallJsBuiltin(isolate, "ArraySlice", args); |
| 663 } | 663 } |
| 664 len = Smi::cast(len_obj)->value(); | 664 len = Smi::cast(len_obj)->value(); |
| 665 if (len > elms->length()) { | 665 if (len > elms->length()) { |
| 666 return CallJsBuiltin(isolate, "ArraySlice", args); | 666 return CallJsBuiltin(isolate, "ArraySlice", args); |
| 667 } | 667 } |
| 668 for (int i = 0; i < len; i++) { | 668 for (int i = 0; i < len; i++) { |
| 669 if (elms->get(i) == heap->the_hole_value()) { | 669 if (elms->get(i) == heap->the_hole_value()) { |
| 670 return CallJsBuiltin(isolate, "ArraySlice", args); | 670 return CallJsBuiltin(isolate, "ArraySlice", args); |
| (...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 973 | 973 |
| 974 // Set the length and elements. | 974 // Set the length and elements. |
| 975 result_array->set_length(Smi::FromInt(result_len)); | 975 result_array->set_length(Smi::FromInt(result_len)); |
| 976 result_array->set_elements(result_elms); | 976 result_array->set_elements(result_elms); |
| 977 | 977 |
| 978 return result_array; | 978 return result_array; |
| 979 } | 979 } |
| 980 | 980 |
| 981 | 981 |
| 982 // ----------------------------------------------------------------------------- | 982 // ----------------------------------------------------------------------------- |
| 983 // Strict mode poison pills |
| 984 |
| 985 |
| 986 BUILTIN(StrictArgumentsCallee) { |
| 987 HandleScope scope; |
| 988 return isolate->Throw(*isolate->factory()->NewTypeError( |
| 989 "strict_arguments_callee", HandleVector<Object>(NULL, 0))); |
| 990 } |
| 991 |
| 992 |
| 993 BUILTIN(StrictArgumentsCaller) { |
| 994 HandleScope scope; |
| 995 return isolate->Throw(*isolate->factory()->NewTypeError( |
| 996 "strict_arguments_caller", HandleVector<Object>(NULL, 0))); |
| 997 } |
| 998 |
| 999 |
| 1000 BUILTIN(StrictFunctionCaller) { |
| 1001 HandleScope scope; |
| 1002 return isolate->Throw(*isolate->factory()->NewTypeError( |
| 1003 "strict_function_caller", HandleVector<Object>(NULL, 0))); |
| 1004 } |
| 1005 |
| 1006 |
| 1007 BUILTIN(StrictFunctionArguments) { |
| 1008 HandleScope scope; |
| 1009 return isolate->Throw(*isolate->factory()->NewTypeError( |
| 1010 "strict_function_arguments", HandleVector<Object>(NULL, 0))); |
| 1011 } |
| 1012 |
| 1013 |
| 1014 // ----------------------------------------------------------------------------- |
| 983 // | 1015 // |
| 984 | 1016 |
| 985 | 1017 |
| 986 // Returns the holder JSObject if the function can legally be called | 1018 // Returns the holder JSObject if the function can legally be called |
| 987 // with this receiver. Returns Heap::null_value() if the call is | 1019 // with this receiver. Returns Heap::null_value() if the call is |
| 988 // illegal. Any arguments that don't fit the expected type is | 1020 // illegal. Any arguments that don't fit the expected type is |
| 989 // overwritten with undefined. Arguments that do fit the expected | 1021 // overwritten with undefined. Arguments that do fit the expected |
| 990 // type is overwritten with the object in the prototype chain that | 1022 // type is overwritten with the object in the prototype chain that |
| 991 // actually has that type. | 1023 // actually has that type. |
| 992 static inline Object* TypeCheck(Heap* heap, | 1024 static inline Object* TypeCheck(Heap* heap, |
| (...skipping 654 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1647 if (entry->contains(pc)) { | 1679 if (entry->contains(pc)) { |
| 1648 return names_[i]; | 1680 return names_[i]; |
| 1649 } | 1681 } |
| 1650 } | 1682 } |
| 1651 } | 1683 } |
| 1652 return NULL; | 1684 return NULL; |
| 1653 } | 1685 } |
| 1654 | 1686 |
| 1655 | 1687 |
| 1656 } } // namespace v8::internal | 1688 } } // namespace v8::internal |
| OLD | NEW |