Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(301)

Side by Side Diff: src/builtins.cc

Issue 6698015: Implement strict mode arguments caller/callee. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: Kevin's feedback. Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 622 matching lines...) Expand 10 before | Expand all | Expand 10 after
633 633
634 bool is_arguments_object_with_fast_elements = 634 bool is_arguments_object_with_fast_elements =
635 receiver->IsJSObject() 635 receiver->IsJSObject()
636 && JSObject::cast(receiver)->map() == arguments_map 636 && JSObject::cast(receiver)->map() == arguments_map
637 && JSObject::cast(receiver)->HasFastElements(); 637 && JSObject::cast(receiver)->HasFastElements();
638 if (!is_arguments_object_with_fast_elements) { 638 if (!is_arguments_object_with_fast_elements) {
639 return CallJsBuiltin("ArraySlice", args); 639 return CallJsBuiltin("ArraySlice", args);
640 } 640 }
641 elms = FixedArray::cast(JSObject::cast(receiver)->elements()); 641 elms = FixedArray::cast(JSObject::cast(receiver)->elements());
642 Object* len_obj = JSObject::cast(receiver) 642 Object* len_obj = JSObject::cast(receiver)
643 ->InObjectPropertyAt(Heap::arguments_length_index); 643 ->InObjectPropertyAt(Heap::kArgumentsLengthIndex);
644 if (!len_obj->IsSmi()) { 644 if (!len_obj->IsSmi()) {
645 return CallJsBuiltin("ArraySlice", args); 645 return CallJsBuiltin("ArraySlice", args);
646 } 646 }
647 len = Smi::cast(len_obj)->value(); 647 len = Smi::cast(len_obj)->value();
648 if (len > elms->length()) { 648 if (len > elms->length()) {
649 return CallJsBuiltin("ArraySlice", args); 649 return CallJsBuiltin("ArraySlice", args);
650 } 650 }
651 for (int i = 0; i < len; i++) { 651 for (int i = 0; i < len; i++) {
652 if (elms->get(i) == Heap::the_hole_value()) { 652 if (elms->get(i) == Heap::the_hole_value()) {
653 return CallJsBuiltin("ArraySlice", args); 653 return CallJsBuiltin("ArraySlice", args);
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
955 result_array->set_elements(result_elms); 955 result_array->set_elements(result_elms);
956 956
957 return result_array; 957 return result_array;
958 } 958 }
959 959
960 960
961 // ----------------------------------------------------------------------------- 961 // -----------------------------------------------------------------------------
962 // Strict mode poison pills 962 // Strict mode poison pills
963 963
964 964
965 BUILTIN(StrictArgumentsCallee) {
966 HandleScope scope;
967 return Top::Throw(*Factory::NewTypeError("strict_arguments_callee",
968 HandleVector<Object>(NULL, 0)));
969 }
970
971
972 BUILTIN(StrictArgumentsCaller) {
973 HandleScope scope;
974 return Top::Throw(*Factory::NewTypeError("strict_arguments_caller",
975 HandleVector<Object>(NULL, 0)));
976 }
977
978
965 BUILTIN(StrictFunctionCaller) { 979 BUILTIN(StrictFunctionCaller) {
966 HandleScope scope; 980 HandleScope scope;
967 return Top::Throw(*Factory::NewTypeError("strict_function_caller", 981 return Top::Throw(*Factory::NewTypeError("strict_function_caller",
968 HandleVector<Object>(NULL, 0))); 982 HandleVector<Object>(NULL, 0)));
969 } 983 }
970 984
971 985
972 BUILTIN(StrictFunctionArguments) { 986 BUILTIN(StrictFunctionArguments) {
973 HandleScope scope; 987 HandleScope scope;
974 return Top::Throw(*Factory::NewTypeError("strict_function_arguments", 988 return Top::Throw(*Factory::NewTypeError("strict_function_arguments",
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1595 if (entry->contains(pc)) { 1609 if (entry->contains(pc)) {
1596 return names_[i]; 1610 return names_[i];
1597 } 1611 }
1598 } 1612 }
1599 } 1613 }
1600 return NULL; 1614 return NULL;
1601 } 1615 }
1602 1616
1603 1617
1604 } } // namespace v8::internal 1618 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698