| OLD | NEW |
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 927 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 938 __ CallApiFunctionAndReturn(ref, | 938 __ CallApiFunctionAndReturn(ref, |
| 939 function_address, | 939 function_address, |
| 940 thunk_ref, | 940 thunk_ref, |
| 941 x1, | 941 x1, |
| 942 kStackUnwindSpace, | 942 kStackUnwindSpace, |
| 943 spill_offset, | 943 spill_offset, |
| 944 kFastApiCallArguments + 1); | 944 kFastApiCallArguments + 1); |
| 945 } | 945 } |
| 946 | 946 |
| 947 | 947 |
| 948 // Generate call to api function. |
| 949 static void GenerateFastApiCall(MacroAssembler* masm, |
| 950 const CallOptimization& optimization, |
| 951 Register receiver, |
| 952 Register scratch, |
| 953 int argc, |
| 954 Register* values) { |
| 955 ASSERT(optimization.is_simple_api_call()); |
| 956 ASSERT(!AreAliased(receiver, scratch)); |
| 957 |
| 958 const int stack_space = kFastApiCallArguments + argc + 1; |
| 959 // Assign stack space for the call arguments. |
| 960 __ Claim(stack_space); |
| 961 // Write holder to stack frame. |
| 962 __ Poke(receiver, 0); |
| 963 // Write receiver to stack frame. |
| 964 int index = stack_space - 1; |
| 965 __ Poke(receiver, index * kPointerSize); |
| 966 // Write the arguments to stack frame. |
| 967 for (int i = 0; i < argc; i++) { |
| 968 // TODO(jbramley): This is broken, but it is broken on ARM too. |
| 969 ASSERT(!AreAliased(receiver, scratch, values[i])); |
| 970 __ Poke(receiver, index-- * kPointerSize); |
| 971 } |
| 972 |
| 973 GenerateFastApiDirectCall(masm, optimization, argc); |
| 974 } |
| 975 |
| 976 |
| 948 class CallInterceptorCompiler BASE_EMBEDDED { | 977 class CallInterceptorCompiler BASE_EMBEDDED { |
| 949 public: | 978 public: |
| 950 CallInterceptorCompiler(StubCompiler* stub_compiler, | 979 CallInterceptorCompiler(StubCompiler* stub_compiler, |
| 951 const ParameterCount& arguments, | 980 const ParameterCount& arguments, |
| 952 Register name, | 981 Register name, |
| 953 Code::ExtraICState extra_ic_state) | 982 Code::ExtraICState extra_ic_state) |
| 954 : stub_compiler_(stub_compiler), | 983 : stub_compiler_(stub_compiler), |
| 955 arguments_(arguments), | 984 arguments_(arguments), |
| 956 name_(name), | 985 name_(name), |
| 957 extra_ic_state_(extra_ic_state) {} | 986 extra_ic_state_(extra_ic_state) {} |
| (...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1288 } | 1317 } |
| 1289 } | 1318 } |
| 1290 | 1319 |
| 1291 | 1320 |
| 1292 Register BaseLoadStubCompiler::CallbackHandlerFrontend( | 1321 Register BaseLoadStubCompiler::CallbackHandlerFrontend( |
| 1293 Handle<JSObject> object, | 1322 Handle<JSObject> object, |
| 1294 Register object_reg, | 1323 Register object_reg, |
| 1295 Handle<JSObject> holder, | 1324 Handle<JSObject> holder, |
| 1296 Handle<Name> name, | 1325 Handle<Name> name, |
| 1297 Label* success, | 1326 Label* success, |
| 1298 Handle<ExecutableAccessorInfo> callback) { | 1327 Handle<Object> callback) { |
| 1299 Label miss; | 1328 Label miss; |
| 1300 | 1329 |
| 1301 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); | 1330 Register reg = HandlerFrontendHeader(object, object_reg, holder, name, &miss); |
| 1302 | 1331 |
| 1303 // TODO(jbramely): HandlerFrontendHeader returns its result in scratch1(), so | 1332 // TODO(jbramely): HandlerFrontendHeader returns its result in scratch1(), so |
| 1304 // we can't use it below, but that isn't very obvious. Is there a better way | 1333 // we can't use it below, but that isn't very obvious. Is there a better way |
| 1305 // of handling this? | 1334 // of handling this? |
| 1306 | 1335 |
| 1307 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { | 1336 if (!holder->HasFastProperties() && !holder->IsJSGlobalObject()) { |
| 1308 ASSERT(!AreAliased(reg, scratch2(), scratch3(), scratch4())); | 1337 ASSERT(!AreAliased(reg, scratch2(), scratch3(), scratch4())); |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1379 | 1408 |
| 1380 | 1409 |
| 1381 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { | 1410 void BaseLoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { |
| 1382 // Return the constant value. | 1411 // Return the constant value. |
| 1383 __ LoadObject(x0, value); | 1412 __ LoadObject(x0, value); |
| 1384 __ Ret(); | 1413 __ Ret(); |
| 1385 } | 1414 } |
| 1386 | 1415 |
| 1387 | 1416 |
| 1388 void BaseLoadStubCompiler::GenerateLoadCallback( | 1417 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1418 const CallOptimization& call_optimization) { |
| 1419 GenerateFastApiCall( |
| 1420 masm(), call_optimization, receiver(), scratch3(), 0, NULL); |
| 1421 } |
| 1422 |
| 1423 |
| 1424 void BaseLoadStubCompiler::GenerateLoadCallback( |
| 1389 Register reg, | 1425 Register reg, |
| 1390 Handle<ExecutableAccessorInfo> callback) { | 1426 Handle<ExecutableAccessorInfo> callback) { |
| 1391 // Build ExecutableAccessorInfo::args_ list on the stack and push property | 1427 // Build ExecutableAccessorInfo::args_ list on the stack and push property |
| 1392 // name below the exit frame to make GC aware of them and store pointers to | 1428 // name below the exit frame to make GC aware of them and store pointers to |
| 1393 // them. | 1429 // them. |
| 1394 __ Push(receiver()); | 1430 __ Push(receiver()); |
| 1395 Register args_addr = scratch2(); | 1431 Register args_addr = scratch2(); |
| 1396 __ Mov(args_addr, __ StackPointer()); | 1432 __ Mov(args_addr, __ StackPointer()); |
| 1397 | 1433 |
| 1398 if (heap()->InNewSpace(callback->data())) { | 1434 if (heap()->InNewSpace(callback->data())) { |
| (...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2930 // Do tail-call to the runtime system. | 2966 // Do tail-call to the runtime system. |
| 2931 ExternalReference store_ic_property = | 2967 ExternalReference store_ic_property = |
| 2932 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); | 2968 ExternalReference(IC_Utility(IC::kStoreInterceptorProperty), isolate()); |
| 2933 __ TailCallExternalReference(store_ic_property, 4, 1); | 2969 __ TailCallExternalReference(store_ic_property, 4, 1); |
| 2934 | 2970 |
| 2935 // Handle store cache miss. | 2971 // Handle store cache miss. |
| 2936 __ Bind(&miss); | 2972 __ Bind(&miss); |
| 2937 TailCallBuiltin(masm(), MissBuiltin(kind())); | 2973 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 2938 | 2974 |
| 2939 // Return the generated code. | 2975 // Return the generated code. |
| 2940 return GetICCode(kind(), Code::INTERCEPTOR, name); | 2976 return GetCode(kind(), Code::INTERCEPTOR, name); |
| 2941 } | 2977 } |
| 2942 | 2978 |
| 2943 | 2979 |
| 2944 Handle<Code> StoreStubCompiler::CompileStoreGlobal( | 2980 Handle<Code> StoreStubCompiler::CompileStoreGlobal( |
| 2945 Handle<GlobalObject> object, | 2981 Handle<GlobalObject> object, |
| 2946 Handle<PropertyCell> cell, | 2982 Handle<PropertyCell> cell, |
| 2947 Handle<Name> name) { | 2983 Handle<Name> name) { |
| 2948 Label miss; | 2984 Label miss; |
| 2949 | 2985 |
| 2950 ASM_LOCATION("StoreStubCompiler::CompileStoreGlobal"); | 2986 ASM_LOCATION("StoreStubCompiler::CompileStoreGlobal"); |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3193 } | 3229 } |
| 3194 | 3230 |
| 3195 __ Bind(&miss); | 3231 __ Bind(&miss); |
| 3196 TailCallBuiltin(masm(), MissBuiltin(kind())); | 3232 TailCallBuiltin(masm(), MissBuiltin(kind())); |
| 3197 | 3233 |
| 3198 return GetICCode( | 3234 return GetICCode( |
| 3199 kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); | 3235 kind(), Code::NORMAL, factory()->empty_string(), POLYMORPHIC); |
| 3200 } | 3236 } |
| 3201 | 3237 |
| 3202 | 3238 |
| 3239 Handle<Code> StoreStubCompiler::CompileStoreCallback( |
| 3240 Handle<JSObject> object, |
| 3241 Handle<JSObject> holder, |
| 3242 Handle<Name> name, |
| 3243 const CallOptimization& call_optimization) { |
| 3244 Label success; |
| 3245 HandlerFrontend(object, receiver(), holder, name, &success); |
| 3246 __ Bind(&success); |
| 3247 |
| 3248 Register values[] = { value() }; |
| 3249 GenerateFastApiCall( |
| 3250 masm(), call_optimization, receiver(), scratch3(), 1, values); |
| 3251 |
| 3252 // Return the generated code. |
| 3253 return GetCode(kind(), Code::CALLBACKS, name); |
| 3254 } |
| 3255 |
| 3256 |
| 3203 #undef __ | 3257 #undef __ |
| 3204 #define __ ACCESS_MASM(masm) | 3258 #define __ ACCESS_MASM(masm) |
| 3205 | 3259 |
| 3206 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( | 3260 void KeyedLoadStubCompiler::GenerateLoadDictionaryElement( |
| 3207 MacroAssembler* masm) { | 3261 MacroAssembler* masm) { |
| 3208 // ---------- S t a t e -------------- | 3262 // ---------- S t a t e -------------- |
| 3209 // -- lr : return address | 3263 // -- lr : return address |
| 3210 // -- x0 : key | 3264 // -- x0 : key |
| 3211 // -- x1 : receiver | 3265 // -- x1 : receiver |
| 3212 // ----------------------------------- | 3266 // ----------------------------------- |
| (...skipping 15 matching lines...) Expand all Loading... |
| 3228 | 3282 |
| 3229 // Miss case, call the runtime. | 3283 // Miss case, call the runtime. |
| 3230 __ Bind(&miss_force_generic); | 3284 __ Bind(&miss_force_generic); |
| 3231 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); | 3285 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); |
| 3232 } | 3286 } |
| 3233 | 3287 |
| 3234 | 3288 |
| 3235 } } // namespace v8::internal | 3289 } } // namespace v8::internal |
| 3236 | 3290 |
| 3237 #endif // V8_TARGET_ARCH_A64 | 3291 #endif // V8_TARGET_ARCH_A64 |
| OLD | NEW |