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

Side by Side Diff: src/arm/macro-assembler-arm.cc

Issue 2860049: Port prototype-call-stubs for normal objects (http://codereview.chromium.org/... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 10 years, 5 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/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.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-2009 the V8 project authors. All rights reserved. 1 // Copyright 2006-2009 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 855 matching lines...) Expand 10 before | Expand all | Expand 10 after
866 866
867 void MacroAssembler::PopTryHandler() { 867 void MacroAssembler::PopTryHandler() {
868 ASSERT_EQ(0, StackHandlerConstants::kNextOffset); 868 ASSERT_EQ(0, StackHandlerConstants::kNextOffset);
869 pop(r1); 869 pop(r1);
870 mov(ip, Operand(ExternalReference(Top::k_handler_address))); 870 mov(ip, Operand(ExternalReference(Top::k_handler_address)));
871 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize)); 871 add(sp, sp, Operand(StackHandlerConstants::kSize - kPointerSize));
872 str(r1, MemOperand(ip)); 872 str(r1, MemOperand(ip));
873 } 873 }
874 874
875 875
876 Register MacroAssembler::CheckMaps(JSObject* object, Register object_reg,
877 JSObject* holder, Register holder_reg,
878 Register scratch,
879 int save_at_depth,
880 Label* miss) {
881 // Make sure there's no overlap between scratch and the other
882 // registers.
883 ASSERT(!scratch.is(object_reg) && !scratch.is(holder_reg));
884
885 // Keep track of the current object in register reg.
886 Register reg = object_reg;
887 int depth = 0;
888
889 if (save_at_depth == depth) {
890 str(reg, MemOperand(sp));
891 }
892
893 // Check the maps in the prototype chain.
894 // Traverse the prototype chain from the object and do map checks.
895 while (object != holder) {
896 depth++;
897
898 // Only global objects and objects that do not require access
899 // checks are allowed in stubs.
900 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
901
902 // Get the map of the current object.
903 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
904 cmp(scratch, Operand(Handle<Map>(object->map())));
905
906 // Branch on the result of the map check.
907 b(ne, miss);
908
909 // Check access rights to the global object. This has to happen
910 // after the map check so that we know that the object is
911 // actually a global object.
912 if (object->IsJSGlobalProxy()) {
913 CheckAccessGlobalProxy(reg, scratch, miss);
914 // Restore scratch register to be the map of the object. In the
915 // new space case below, we load the prototype from the map in
916 // the scratch register.
917 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
918 }
919
920 reg = holder_reg; // from now the object is in holder_reg
921 JSObject* prototype = JSObject::cast(object->GetPrototype());
922 if (Heap::InNewSpace(prototype)) {
923 // The prototype is in new space; we cannot store a reference
924 // to it in the code. Load it from the map.
925 ldr(reg, FieldMemOperand(scratch, Map::kPrototypeOffset));
926 } else {
927 // The prototype is in old space; load it directly.
928 mov(reg, Operand(Handle<JSObject>(prototype)));
929 }
930
931 if (save_at_depth == depth) {
932 str(reg, MemOperand(sp));
933 }
934
935 // Go to the next object in the prototype chain.
936 object = prototype;
937 }
938
939 // Check the holder map.
940 ldr(scratch, FieldMemOperand(reg, HeapObject::kMapOffset));
941 cmp(scratch, Operand(Handle<Map>(object->map())));
942 b(ne, miss);
943
944 // Log the check depth.
945 LOG(IntEvent("check-maps-depth", depth + 1));
946
947 // Perform security check for access to the global object and return
948 // the holder register.
949 ASSERT(object == holder);
950 ASSERT(object->IsJSGlobalProxy() || !object->IsAccessCheckNeeded());
951 if (object->IsJSGlobalProxy()) {
952 CheckAccessGlobalProxy(reg, scratch, miss);
953 }
954 return reg;
955 }
956
957
958 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg, 876 void MacroAssembler::CheckAccessGlobalProxy(Register holder_reg,
959 Register scratch, 877 Register scratch,
960 Label* miss) { 878 Label* miss) {
961 Label same_contexts; 879 Label same_contexts;
962 880
963 ASSERT(!holder_reg.is(scratch)); 881 ASSERT(!holder_reg.is(scratch));
964 ASSERT(!holder_reg.is(ip)); 882 ASSERT(!holder_reg.is(ip));
965 ASSERT(!scratch.is(ip)); 883 ASSERT(!scratch.is(ip));
966 884
967 // Load current lexical context from the stack frame. 885 // Load current lexical context from the stack frame.
(...skipping 966 matching lines...) Expand 10 before | Expand all | Expand 10 after
1934 1852
1935 void CodePatcher::Emit(Address addr) { 1853 void CodePatcher::Emit(Address addr) {
1936 masm()->emit(reinterpret_cast<Instr>(addr)); 1854 masm()->emit(reinterpret_cast<Instr>(addr));
1937 } 1855 }
1938 #endif // ENABLE_DEBUGGER_SUPPORT 1856 #endif // ENABLE_DEBUGGER_SUPPORT
1939 1857
1940 1858
1941 } } // namespace v8::internal 1859 } } // namespace v8::internal
1942 1860
1943 #endif // V8_TARGET_ARCH_ARM 1861 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.h ('k') | src/arm/stub-cache-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698