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

Side by Side Diff: src/builtins.cc

Issue 3031005: [Isolates] Avoid dereferencing Isolate::Current() to check oddball identities... (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: '' Created 10 years, 4 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/ast.h ('k') | src/debug.cc » ('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 860 matching lines...) Expand 10 before | Expand all | Expand 10 after
871 static inline Object* TypeCheck(int argc, 871 static inline Object* TypeCheck(int argc,
872 Object** argv, 872 Object** argv,
873 FunctionTemplateInfo* info) { 873 FunctionTemplateInfo* info) {
874 Object* recv = argv[0]; 874 Object* recv = argv[0];
875 Object* sig_obj = info->signature(); 875 Object* sig_obj = info->signature();
876 if (sig_obj->IsUndefined()) return recv; 876 if (sig_obj->IsUndefined()) return recv;
877 SignatureInfo* sig = SignatureInfo::cast(sig_obj); 877 SignatureInfo* sig = SignatureInfo::cast(sig_obj);
878 // If necessary, check the receiver 878 // If necessary, check the receiver
879 Object* recv_type = sig->receiver(); 879 Object* recv_type = sig->receiver();
880 880
881 Heap* heap = HEAP;
881 Object* holder = recv; 882 Object* holder = recv;
882 if (!recv_type->IsUndefined()) { 883 if (!recv_type->IsUndefined()) {
883 for (; holder != HEAP->null_value(); holder = holder->GetPrototype()) { 884 for (; holder != heap->null_value(); holder = holder->GetPrototype()) {
884 if (holder->IsInstanceOf(FunctionTemplateInfo::cast(recv_type))) { 885 if (holder->IsInstanceOf(FunctionTemplateInfo::cast(recv_type))) {
885 break; 886 break;
886 } 887 }
887 } 888 }
888 if (holder == HEAP->null_value()) return holder; 889 if (holder == heap->null_value()) return holder;
889 } 890 }
890 Object* args_obj = sig->args(); 891 Object* args_obj = sig->args();
891 // If there is no argument signature we're done 892 // If there is no argument signature we're done
892 if (args_obj->IsUndefined()) return holder; 893 if (args_obj->IsUndefined()) return holder;
893 FixedArray* args = FixedArray::cast(args_obj); 894 FixedArray* args = FixedArray::cast(args_obj);
894 int length = args->length(); 895 int length = args->length();
895 if (argc <= length) length = argc - 1; 896 if (argc <= length) length = argc - 1;
896 for (int i = 0; i < length; i++) { 897 for (int i = 0; i < length; i++) {
897 Object* argtype = args->get(i); 898 Object* argtype = args->get(i);
898 if (argtype->IsUndefined()) continue; 899 if (argtype->IsUndefined()) continue;
899 Object** arg = &argv[-1 - i]; 900 Object** arg = &argv[-1 - i];
900 Object* current = *arg; 901 Object* current = *arg;
901 for (; current != HEAP->null_value(); current = current->GetPrototype()) { 902 for (; current != heap->null_value(); current = current->GetPrototype()) {
902 if (current->IsInstanceOf(FunctionTemplateInfo::cast(argtype))) { 903 if (current->IsInstanceOf(FunctionTemplateInfo::cast(argtype))) {
903 *arg = current; 904 *arg = current;
904 break; 905 break;
905 } 906 }
906 } 907 }
907 if (current == HEAP->null_value()) *arg = HEAP->undefined_value(); 908 if (current == heap->null_value()) *arg = heap->undefined_value();
908 } 909 }
909 return holder; 910 return holder;
910 } 911 }
911 912
912 913
913 template <bool is_construct> 914 template <bool is_construct>
914 static Object* HandleApiCallHelper( 915 static Object* HandleApiCallHelper(
915 BuiltinArguments<NEEDS_CALLED_FUNCTION> args) { 916 BuiltinArguments<NEEDS_CALLED_FUNCTION> args) {
916 ASSERT(is_construct == CalledAsConstructor()); 917 ASSERT(is_construct == CalledAsConstructor());
917 918
(...skipping 639 matching lines...) Expand 10 before | Expand all | Expand 10 after
1557 if (entry->contains(pc)) { 1558 if (entry->contains(pc)) {
1558 return names_[i]; 1559 return names_[i];
1559 } 1560 }
1560 } 1561 }
1561 } 1562 }
1562 return NULL; 1563 return NULL;
1563 } 1564 }
1564 1565
1565 1566
1566 } } // namespace v8::internal 1567 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/ast.h ('k') | src/debug.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698