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

Side by Side Diff: src/arm/stub-cache-arm.cc

Issue 6392003: Minor cleanup: Use MaybeObject instead of bool and Failure** in... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 9 years, 11 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 | « no previous file | src/ia32/stub-cache-ia32.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 1176 matching lines...) Expand 10 before | Expand all | Expand 10 after
1187 Register reg = 1187 Register reg =
1188 CheckPrototypes(object, receiver, holder, 1188 CheckPrototypes(object, receiver, holder,
1189 scratch1, scratch2, scratch3, name, miss); 1189 scratch1, scratch2, scratch3, name, miss);
1190 1190
1191 // Return the constant value. 1191 // Return the constant value.
1192 __ mov(r0, Operand(Handle<Object>(value))); 1192 __ mov(r0, Operand(Handle<Object>(value)));
1193 __ Ret(); 1193 __ Ret();
1194 } 1194 }
1195 1195
1196 1196
1197 bool StubCompiler::GenerateLoadCallback(JSObject* object, 1197 MaybeObject* StubCompiler::GenerateLoadCallback(JSObject* object,
1198 JSObject* holder, 1198 JSObject* holder,
1199 Register receiver, 1199 Register receiver,
1200 Register name_reg, 1200 Register name_reg,
1201 Register scratch1, 1201 Register scratch1,
1202 Register scratch2, 1202 Register scratch2,
1203 Register scratch3, 1203 Register scratch3,
1204 AccessorInfo* callback, 1204 AccessorInfo* callback,
1205 String* name, 1205 String* name,
1206 Label* miss, 1206 Label* miss) {
1207 Failure** failure) {
1208 // Check that the receiver isn't a smi. 1207 // Check that the receiver isn't a smi.
1209 __ tst(receiver, Operand(kSmiTagMask)); 1208 __ tst(receiver, Operand(kSmiTagMask));
1210 __ b(eq, miss); 1209 __ b(eq, miss);
1211 1210
1212 // Check that the maps haven't changed. 1211 // Check that the maps haven't changed.
1213 Register reg = 1212 Register reg =
1214 CheckPrototypes(object, receiver, holder, scratch1, scratch2, scratch3, 1213 CheckPrototypes(object, receiver, holder, scratch1, scratch2, scratch3,
1215 name, miss); 1214 name, miss);
1216 1215
1217 // Push the arguments on the JS stack of the caller. 1216 // Push the arguments on the JS stack of the caller.
1218 __ push(receiver); // Receiver. 1217 __ push(receiver); // Receiver.
1219 __ mov(scratch3, Operand(Handle<AccessorInfo>(callback))); // callback data 1218 __ mov(scratch3, Operand(Handle<AccessorInfo>(callback))); // callback data
1220 __ ldr(ip, FieldMemOperand(scratch3, AccessorInfo::kDataOffset)); 1219 __ ldr(ip, FieldMemOperand(scratch3, AccessorInfo::kDataOffset));
1221 __ Push(reg, ip, scratch3, name_reg); 1220 __ Push(reg, ip, scratch3, name_reg);
1222 1221
1223 // Do tail-call to the runtime system. 1222 // Do tail-call to the runtime system.
1224 ExternalReference load_callback_property = 1223 ExternalReference load_callback_property =
1225 ExternalReference(IC_Utility(IC::kLoadCallbackProperty)); 1224 ExternalReference(IC_Utility(IC::kLoadCallbackProperty));
1226 __ TailCallExternalReference(load_callback_property, 5, 1); 1225 __ TailCallExternalReference(load_callback_property, 5, 1);
1227 1226
1228 return true; 1227 return Heap::undefined_value(); // Success.
1229 } 1228 }
1230 1229
1231 1230
1232 void StubCompiler::GenerateLoadInterceptor(JSObject* object, 1231 void StubCompiler::GenerateLoadInterceptor(JSObject* object,
1233 JSObject* interceptor_holder, 1232 JSObject* interceptor_holder,
1234 LookupResult* lookup, 1233 LookupResult* lookup,
1235 Register receiver, 1234 Register receiver,
1236 Register name_reg, 1235 Register name_reg,
1237 Register scratch1, 1236 Register scratch1,
1238 Register scratch2, 1237 Register scratch2,
(...skipping 1492 matching lines...) Expand 10 before | Expand all | Expand 10 after
2731 JSObject* object, 2730 JSObject* object,
2732 JSObject* holder, 2731 JSObject* holder,
2733 AccessorInfo* callback) { 2732 AccessorInfo* callback) {
2734 // ----------- S t a t e ------------- 2733 // ----------- S t a t e -------------
2735 // -- r0 : receiver 2734 // -- r0 : receiver
2736 // -- r2 : name 2735 // -- r2 : name
2737 // -- lr : return address 2736 // -- lr : return address
2738 // ----------------------------------- 2737 // -----------------------------------
2739 Label miss; 2738 Label miss;
2740 2739
2741 Failure* failure = Failure::InternalError(); 2740 MaybeObject* result = GenerateLoadCallback(object, holder, r0, r2, r3, r1, r4,
2742 bool success = GenerateLoadCallback(object, holder, r0, r2, r3, r1, r4, 2741 callback, name, &miss);
2743 callback, name, &miss, &failure); 2742 if (result->IsFailure()) {
2744 if (!success) {
2745 miss.Unuse(); 2743 miss.Unuse();
2746 return failure; 2744 return result;
2747 } 2745 }
2748 2746
2749 __ bind(&miss); 2747 __ bind(&miss);
2750 GenerateLoadMiss(masm(), Code::LOAD_IC); 2748 GenerateLoadMiss(masm(), Code::LOAD_IC);
2751 2749
2752 // Return the generated code. 2750 // Return the generated code.
2753 return GetCode(CALLBACKS, name); 2751 return GetCode(CALLBACKS, name);
2754 } 2752 }
2755 2753
2756 2754
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
2883 // -- lr : return address 2881 // -- lr : return address
2884 // -- r0 : key 2882 // -- r0 : key
2885 // -- r1 : receiver 2883 // -- r1 : receiver
2886 // ----------------------------------- 2884 // -----------------------------------
2887 Label miss; 2885 Label miss;
2888 2886
2889 // Check the key is the cached one. 2887 // Check the key is the cached one.
2890 __ cmp(r0, Operand(Handle<String>(name))); 2888 __ cmp(r0, Operand(Handle<String>(name)));
2891 __ b(ne, &miss); 2889 __ b(ne, &miss);
2892 2890
2893 Failure* failure = Failure::InternalError(); 2891 MaybeObject* result = GenerateLoadCallback(receiver, holder, r1, r0, r2, r3,
2894 bool success = GenerateLoadCallback(receiver, holder, r1, r0, r2, r3, r4, 2892 r4, callback, name, &miss);
2895 callback, name, &miss, &failure); 2893 if (result->IsFailure()) {
2896 if (!success) {
2897 miss.Unuse(); 2894 miss.Unuse();
2898 return failure; 2895 return result;
2899 } 2896 }
2900 2897
2901 __ bind(&miss); 2898 __ bind(&miss);
2902 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC); 2899 GenerateLoadMiss(masm(), Code::KEYED_LOAD_IC);
2903 2900
2904 return GetCode(CALLBACKS, name); 2901 return GetCode(CALLBACKS, name);
2905 } 2902 }
2906 2903
2907 2904
2908 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name, 2905 MaybeObject* KeyedLoadStubCompiler::CompileLoadConstant(String* name,
(...skipping 1015 matching lines...) Expand 10 before | Expand all | Expand 10 after
3924 3921
3925 return GetCode(flags); 3922 return GetCode(flags);
3926 } 3923 }
3927 3924
3928 3925
3929 #undef __ 3926 #undef __
3930 3927
3931 } } // namespace v8::internal 3928 } } // namespace v8::internal
3932 3929
3933 #endif // V8_TARGET_ARCH_ARM 3930 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « no previous file | src/ia32/stub-cache-ia32.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698