| 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 630 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 641 | 641 |
| 642 bool is_arguments_object_with_fast_elements = | 642 bool is_arguments_object_with_fast_elements = |
| 643 receiver->IsJSObject() | 643 receiver->IsJSObject() |
| 644 && JSObject::cast(receiver)->map() == arguments_map | 644 && JSObject::cast(receiver)->map() == arguments_map |
| 645 && JSObject::cast(receiver)->HasFastElements(); | 645 && JSObject::cast(receiver)->HasFastElements(); |
| 646 if (!is_arguments_object_with_fast_elements) { | 646 if (!is_arguments_object_with_fast_elements) { |
| 647 return CallJsBuiltin("ArraySlice", args); | 647 return CallJsBuiltin("ArraySlice", args); |
| 648 } | 648 } |
| 649 elms = FixedArray::cast(JSObject::cast(receiver)->elements()); | 649 elms = FixedArray::cast(JSObject::cast(receiver)->elements()); |
| 650 Object* len_obj = JSObject::cast(receiver) | 650 Object* len_obj = JSObject::cast(receiver) |
| 651 ->InObjectPropertyAt(Heap::arguments_length_index); | 651 ->InObjectPropertyAt(Heap::kArgumentsLengthIndex); |
| 652 if (!len_obj->IsSmi()) { | 652 if (!len_obj->IsSmi()) { |
| 653 return CallJsBuiltin("ArraySlice", args); | 653 return CallJsBuiltin("ArraySlice", args); |
| 654 } | 654 } |
| 655 len = Smi::cast(len_obj)->value(); | 655 len = Smi::cast(len_obj)->value(); |
| 656 if (len > elms->length()) { | 656 if (len > elms->length()) { |
| 657 return CallJsBuiltin("ArraySlice", args); | 657 return CallJsBuiltin("ArraySlice", args); |
| 658 } | 658 } |
| 659 for (int i = 0; i < len; i++) { | 659 for (int i = 0; i < len; i++) { |
| 660 if (elms->get(i) == Heap::the_hole_value()) { | 660 if (elms->get(i) == Heap::the_hole_value()) { |
| 661 return CallJsBuiltin("ArraySlice", args); | 661 return CallJsBuiltin("ArraySlice", args); |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 960 | 960 |
| 961 // Set the length and elements. | 961 // Set the length and elements. |
| 962 result_array->set_length(Smi::FromInt(result_len)); | 962 result_array->set_length(Smi::FromInt(result_len)); |
| 963 result_array->set_elements(result_elms); | 963 result_array->set_elements(result_elms); |
| 964 | 964 |
| 965 return result_array; | 965 return result_array; |
| 966 } | 966 } |
| 967 | 967 |
| 968 | 968 |
| 969 // ----------------------------------------------------------------------------- | 969 // ----------------------------------------------------------------------------- |
| 970 // Strict mode poison pills |
| 971 |
| 972 |
| 973 BUILTIN(StrictArgumentsCallee) { |
| 974 HandleScope scope; |
| 975 return Top::Throw(*Factory::NewTypeError("strict_arguments_callee", |
| 976 HandleVector<Object>(NULL, 0))); |
| 977 } |
| 978 |
| 979 |
| 980 BUILTIN(StrictArgumentsCaller) { |
| 981 HandleScope scope; |
| 982 return Top::Throw(*Factory::NewTypeError("strict_arguments_caller", |
| 983 HandleVector<Object>(NULL, 0))); |
| 984 } |
| 985 |
| 986 |
| 987 BUILTIN(StrictFunctionCaller) { |
| 988 HandleScope scope; |
| 989 return Top::Throw(*Factory::NewTypeError("strict_function_caller", |
| 990 HandleVector<Object>(NULL, 0))); |
| 991 } |
| 992 |
| 993 |
| 994 BUILTIN(StrictFunctionArguments) { |
| 995 HandleScope scope; |
| 996 return Top::Throw(*Factory::NewTypeError("strict_function_arguments", |
| 997 HandleVector<Object>(NULL, 0))); |
| 998 } |
| 999 |
| 1000 |
| 1001 // ----------------------------------------------------------------------------- |
| 970 // | 1002 // |
| 971 | 1003 |
| 972 | 1004 |
| 973 // Returns the holder JSObject if the function can legally be called | 1005 // Returns the holder JSObject if the function can legally be called |
| 974 // with this receiver. Returns Heap::null_value() if the call is | 1006 // with this receiver. Returns Heap::null_value() if the call is |
| 975 // illegal. Any arguments that don't fit the expected type is | 1007 // illegal. Any arguments that don't fit the expected type is |
| 976 // overwritten with undefined. Arguments that do fit the expected | 1008 // overwritten with undefined. Arguments that do fit the expected |
| 977 // type is overwritten with the object in the prototype chain that | 1009 // type is overwritten with the object in the prototype chain that |
| 978 // actually has that type. | 1010 // actually has that type. |
| 979 static inline Object* TypeCheck(int argc, | 1011 static inline Object* TypeCheck(int argc, |
| (...skipping 605 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1585 if (entry->contains(pc)) { | 1617 if (entry->contains(pc)) { |
| 1586 return names_[i]; | 1618 return names_[i]; |
| 1587 } | 1619 } |
| 1588 } | 1620 } |
| 1589 } | 1621 } |
| 1590 return NULL; | 1622 return NULL; |
| 1591 } | 1623 } |
| 1592 | 1624 |
| 1593 | 1625 |
| 1594 } } // namespace v8::internal | 1626 } } // namespace v8::internal |
| OLD | NEW |