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

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

Issue 71163006: Merge bleeding_edge r17376:17693. (Closed) Base URL: https://v8.googlecode.com/svn/branches/experimental/parser
Patch Set: Fix all.gyp Created 7 years, 1 month 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.cc ('k') | src/array.js » ('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 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 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 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 #endif 114 #endif
115 115
116 // Jump to the first instruction in the code stub. 116 // Jump to the first instruction in the code stub.
117 __ add(pc, code, Operand(Code::kHeaderSize - kHeapObjectTag)); 117 __ add(pc, code, Operand(Code::kHeaderSize - kHeapObjectTag));
118 118
119 // Miss: fall through. 119 // Miss: fall through.
120 __ bind(&miss); 120 __ bind(&miss);
121 } 121 }
122 122
123 123
124 // Helper function used to check that the dictionary doesn't contain 124 void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm,
125 // the property. This function may return false negatives, so miss_label 125 Label* miss_label,
126 // must always call a backup property check that is complete. 126 Register receiver,
127 // This function is safe to call if the receiver has fast properties. 127 Handle<Name> name,
128 // Name must be unique and receiver must be a heap object. 128 Register scratch0,
129 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, 129 Register scratch1) {
130 Label* miss_label,
131 Register receiver,
132 Handle<Name> name,
133 Register scratch0,
134 Register scratch1) {
135 ASSERT(name->IsUniqueName()); 130 ASSERT(name->IsUniqueName());
131 ASSERT(!receiver.is(scratch0));
136 Counters* counters = masm->isolate()->counters(); 132 Counters* counters = masm->isolate()->counters();
137 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); 133 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
138 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); 134 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
139 135
140 Label done; 136 Label done;
141 137
142 const int kInterceptorOrAccessCheckNeededMask = 138 const int kInterceptorOrAccessCheckNeededMask =
143 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); 139 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
144 140
145 // Bail out if the receiver has a named interceptor or requires access checks. 141 // Bail out if the receiver has a named interceptor or requires access checks.
(...skipping 265 matching lines...) Expand 10 before | Expand all | Expand 10 after
411 Label* miss_label) { 407 Label* miss_label) {
412 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 408 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
413 __ mov(r0, scratch1); 409 __ mov(r0, scratch1);
414 __ Ret(); 410 __ Ret();
415 } 411 }
416 412
417 413
418 // Generate code to check that a global property cell is empty. Create 414 // Generate code to check that a global property cell is empty. Create
419 // the property cell at compilation time if no cell exists for the 415 // the property cell at compilation time if no cell exists for the
420 // property. 416 // property.
421 static void GenerateCheckPropertyCell(MacroAssembler* masm, 417 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
422 Handle<GlobalObject> global, 418 Handle<JSGlobalObject> global,
423 Handle<Name> name, 419 Handle<Name> name,
424 Register scratch, 420 Register scratch,
425 Label* miss) { 421 Label* miss) {
426 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name); 422 Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
427 ASSERT(cell->value()->IsTheHole()); 423 ASSERT(cell->value()->IsTheHole());
428 __ mov(scratch, Operand(cell)); 424 __ mov(scratch, Operand(cell));
429 __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); 425 __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
430 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 426 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
431 __ cmp(scratch, ip); 427 __ cmp(scratch, ip);
432 __ b(ne, miss); 428 __ b(ne, miss);
433 } 429 }
434 430
435 431
436 void StoreStubCompiler::GenerateNegativeHolderLookup( 432 void StoreStubCompiler::GenerateNegativeHolderLookup(
437 MacroAssembler* masm, 433 MacroAssembler* masm,
438 Handle<JSObject> holder, 434 Handle<JSObject> holder,
439 Register holder_reg, 435 Register holder_reg,
440 Handle<Name> name, 436 Handle<Name> name,
441 Label* miss) { 437 Label* miss) {
442 if (holder->IsJSGlobalObject()) { 438 if (holder->IsJSGlobalObject()) {
443 GenerateCheckPropertyCell( 439 GenerateCheckPropertyCell(
444 masm, Handle<GlobalObject>::cast(holder), name, scratch1(), miss); 440 masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
445 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { 441 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
446 GenerateDictionaryNegativeLookup( 442 GenerateDictionaryNegativeLookup(
447 masm, miss, holder_reg, name, scratch1(), scratch2()); 443 masm, miss, holder_reg, name, scratch1(), scratch2());
448 } 444 }
449 } 445 }
450 446
451 447
452 // Generate StoreTransition code, value is passed in r0 register. 448 // Generate StoreTransition code, value is passed in r0 register.
453 // When leaving generated code after success, the receiver_reg and name_reg 449 // When leaving generated code after success, the receiver_reg and name_reg
454 // may be clobbered. Upon branch to miss_label, the receiver and name 450 // may be clobbered. Upon branch to miss_label, the receiver and name
(...skipping 15 matching lines...) Expand all
470 Label exit; 466 Label exit;
471 467
472 int descriptor = transition->LastAdded(); 468 int descriptor = transition->LastAdded();
473 DescriptorArray* descriptors = transition->instance_descriptors(); 469 DescriptorArray* descriptors = transition->instance_descriptors();
474 PropertyDetails details = descriptors->GetDetails(descriptor); 470 PropertyDetails details = descriptors->GetDetails(descriptor);
475 Representation representation = details.representation(); 471 Representation representation = details.representation();
476 ASSERT(!representation.IsNone()); 472 ASSERT(!representation.IsNone());
477 473
478 if (details.type() == CONSTANT) { 474 if (details.type() == CONSTANT) {
479 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); 475 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate());
480 __ LoadObject(scratch1, constant); 476 __ Move(scratch1, constant);
481 __ cmp(value_reg, scratch1); 477 __ cmp(value_reg, scratch1);
482 __ b(ne, miss_label); 478 __ b(ne, miss_label);
483 } else if (FLAG_track_fields && representation.IsSmi()) { 479 } else if (FLAG_track_fields && representation.IsSmi()) {
484 __ JumpIfNotSmi(value_reg, miss_label); 480 __ JumpIfNotSmi(value_reg, miss_label);
485 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 481 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
486 __ JumpIfSmi(value_reg, miss_label); 482 __ JumpIfSmi(value_reg, miss_label);
487 } else if (FLAG_track_double_fields && representation.IsDouble()) { 483 } else if (FLAG_track_double_fields && representation.IsDouble()) {
488 Label do_store, heap_number; 484 Label do_store, heap_number;
489 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex); 485 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex);
490 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow); 486 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow);
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
847 // -- sp[28] : last JS argument 843 // -- sp[28] : last JS argument
848 // -- ... 844 // -- ...
849 // -- sp[(argc + 6) * 4] : first JS argument 845 // -- sp[(argc + 6) * 4] : first JS argument
850 // -- sp[(argc + 7) * 4] : receiver 846 // -- sp[(argc + 7) * 4] : receiver
851 // ----------------------------------- 847 // -----------------------------------
852 typedef FunctionCallbackArguments FCA; 848 typedef FunctionCallbackArguments FCA;
853 // Save calling context. 849 // Save calling context.
854 __ str(cp, MemOperand(sp, FCA::kContextSaveIndex * kPointerSize)); 850 __ str(cp, MemOperand(sp, FCA::kContextSaveIndex * kPointerSize));
855 // Get the function and setup the context. 851 // Get the function and setup the context.
856 Handle<JSFunction> function = optimization.constant_function(); 852 Handle<JSFunction> function = optimization.constant_function();
857 __ LoadHeapObject(r5, function); 853 __ Move(r5, function);
858 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset)); 854 __ ldr(cp, FieldMemOperand(r5, JSFunction::kContextOffset));
859 __ str(r5, MemOperand(sp, FCA::kCalleeIndex * kPointerSize)); 855 __ str(r5, MemOperand(sp, FCA::kCalleeIndex * kPointerSize));
860 856
861 // Construct the FunctionCallbackInfo. 857 // Construct the FunctionCallbackInfo.
862 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 858 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
863 Handle<Object> call_data(api_call_info->data(), masm->isolate()); 859 Handle<Object> call_data(api_call_info->data(), masm->isolate());
864 if (masm->isolate()->heap()->InNewSpace(*call_data)) { 860 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
865 __ Move(r0, api_call_info); 861 __ Move(r0, api_call_info);
866 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset)); 862 __ ldr(r6, FieldMemOperand(r0, CallHandlerInfo::kDataOffset));
867 } else { 863 } else {
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1149 __ b(ne, interceptor_succeeded); 1145 __ b(ne, interceptor_succeeded);
1150 } 1146 }
1151 1147
1152 StubCompiler* stub_compiler_; 1148 StubCompiler* stub_compiler_;
1153 const ParameterCount& arguments_; 1149 const ParameterCount& arguments_;
1154 Register name_; 1150 Register name_;
1155 Code::ExtraICState extra_ic_state_; 1151 Code::ExtraICState extra_ic_state_;
1156 }; 1152 };
1157 1153
1158 1154
1159 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 1155 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
1160 // from object to (but not including) holder. 1156 Handle<JSObject> object,
1161 static void GenerateCheckPropertyCells(MacroAssembler* masm, 1157 Handle<JSObject> holder,
1162 Handle<JSObject> object, 1158 Handle<Name> name,
1163 Handle<JSObject> holder, 1159 Register scratch,
1164 Handle<Name> name, 1160 Label* miss) {
1165 Register scratch,
1166 Label* miss) {
1167 Handle<JSObject> current = object; 1161 Handle<JSObject> current = object;
1168 while (!current.is_identical_to(holder)) { 1162 while (!current.is_identical_to(holder)) {
1169 if (current->IsGlobalObject()) { 1163 if (current->IsJSGlobalObject()) {
1170 GenerateCheckPropertyCell(masm, 1164 GenerateCheckPropertyCell(masm,
1171 Handle<GlobalObject>::cast(current), 1165 Handle<JSGlobalObject>::cast(current),
1172 name, 1166 name,
1173 scratch, 1167 scratch,
1174 miss); 1168 miss);
1175 } 1169 }
1176 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1170 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
1177 } 1171 }
1178 } 1172 }
1179 1173
1180 1174
1181 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { 1175 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
1366 __ ldr(scratch2(), FieldMemOperand(pointer, kValueOffset)); 1360 __ ldr(scratch2(), FieldMemOperand(pointer, kValueOffset));
1367 __ cmp(scratch2(), Operand(callback)); 1361 __ cmp(scratch2(), Operand(callback));
1368 __ b(ne, &miss); 1362 __ b(ne, &miss);
1369 } 1363 }
1370 1364
1371 HandlerFrontendFooter(name, success, &miss); 1365 HandlerFrontendFooter(name, success, &miss);
1372 return reg; 1366 return reg;
1373 } 1367 }
1374 1368
1375 1369
1376 void LoadStubCompiler::NonexistentHandlerFrontend(
1377 Handle<JSObject> object,
1378 Handle<JSObject> last,
1379 Handle<Name> name,
1380 Label* success,
1381 Handle<GlobalObject> global) {
1382 Label miss;
1383
1384 HandlerFrontendHeader(object, receiver(), last, name, &miss);
1385
1386 // If the last object in the prototype chain is a global object,
1387 // check that the global property cell is empty.
1388 if (!global.is_null()) {
1389 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
1390 }
1391
1392 HandlerFrontendFooter(name, success, &miss);
1393 }
1394
1395
1396 void LoadStubCompiler::GenerateLoadField(Register reg, 1370 void LoadStubCompiler::GenerateLoadField(Register reg,
1397 Handle<JSObject> holder, 1371 Handle<JSObject> holder,
1398 PropertyIndex field, 1372 PropertyIndex field,
1399 Representation representation) { 1373 Representation representation) {
1400 if (!reg.is(receiver())) __ mov(receiver(), reg); 1374 if (!reg.is(receiver())) __ mov(receiver(), reg);
1401 if (kind() == Code::LOAD_IC) { 1375 if (kind() == Code::LOAD_IC) {
1402 LoadFieldStub stub(field.is_inobject(holder), 1376 LoadFieldStub stub(field.is_inobject(holder),
1403 field.translate(holder), 1377 field.translate(holder),
1404 representation); 1378 representation);
1405 GenerateTailCall(masm(), stub.GetCode(isolate())); 1379 GenerateTailCall(masm(), stub.GetCode(isolate()));
1406 } else { 1380 } else {
1407 KeyedLoadFieldStub stub(field.is_inobject(holder), 1381 KeyedLoadFieldStub stub(field.is_inobject(holder),
1408 field.translate(holder), 1382 field.translate(holder),
1409 representation); 1383 representation);
1410 GenerateTailCall(masm(), stub.GetCode(isolate())); 1384 GenerateTailCall(masm(), stub.GetCode(isolate()));
1411 } 1385 }
1412 } 1386 }
1413 1387
1414 1388
1415 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 1389 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
1416 // Return the constant value. 1390 // Return the constant value.
1417 __ LoadObject(r0, value); 1391 __ Move(r0, value);
1418 __ Ret(); 1392 __ Ret();
1419 } 1393 }
1420 1394
1421 1395
1422 void LoadStubCompiler::GenerateLoadCallback( 1396 void LoadStubCompiler::GenerateLoadCallback(
1423 const CallOptimization& call_optimization) { 1397 const CallOptimization& call_optimization) {
1424 GenerateFastApiCall( 1398 GenerateFastApiCall(
1425 masm(), call_optimization, receiver(), scratch3(), 0, NULL); 1399 masm(), call_optimization, receiver(), scratch3(), 0, NULL);
1426 } 1400 }
1427 1401
(...skipping 1504 matching lines...) Expand 10 before | Expand all | Expand 10 after
2932 2906
2933 // Return the generated code. 2907 // Return the generated code.
2934 return GetCode(kind(), Code::INTERCEPTOR, name); 2908 return GetCode(kind(), Code::INTERCEPTOR, name);
2935 } 2909 }
2936 2910
2937 2911
2938 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( 2912 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
2939 Handle<JSObject> object, 2913 Handle<JSObject> object,
2940 Handle<JSObject> last, 2914 Handle<JSObject> last,
2941 Handle<Name> name, 2915 Handle<Name> name,
2942 Handle<GlobalObject> global) { 2916 Handle<JSGlobalObject> global) {
2943 Label success; 2917 Label success;
2944 2918
2945 NonexistentHandlerFrontend(object, last, name, &success, global); 2919 NonexistentHandlerFrontend(object, last, name, &success, global);
2946 2920
2947 __ bind(&success); 2921 __ bind(&success);
2948 // Return undefined if maps of the full prototype chain are still the 2922 // Return undefined if maps of the full prototype chain are still the
2949 // same and no global property with this name contains a value. 2923 // same and no global property with this name contains a value.
2950 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex); 2924 __ LoadRoot(r0, Heap::kUndefinedValueRootIndex);
2951 __ Ret(); 2925 __ Ret();
2952 2926
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
3039 3013
3040 3014
3041 Handle<Code> LoadStubCompiler::CompileLoadGlobal( 3015 Handle<Code> LoadStubCompiler::CompileLoadGlobal(
3042 Handle<JSObject> object, 3016 Handle<JSObject> object,
3043 Handle<GlobalObject> global, 3017 Handle<GlobalObject> global,
3044 Handle<PropertyCell> cell, 3018 Handle<PropertyCell> cell,
3045 Handle<Name> name, 3019 Handle<Name> name,
3046 bool is_dont_delete) { 3020 bool is_dont_delete) {
3047 Label success, miss; 3021 Label success, miss;
3048 3022
3049 __ CheckMap( 3023 HandlerFrontendHeader(object, receiver(), global, name, &miss);
3050 receiver(), scratch1(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK);
3051 HandlerFrontendHeader(
3052 object, receiver(), Handle<JSObject>::cast(global), name, &miss);
3053 3024
3054 // Get the value from the cell. 3025 // Get the value from the cell.
3055 __ mov(r3, Operand(cell)); 3026 __ mov(r3, Operand(cell));
3056 __ ldr(r4, FieldMemOperand(r3, Cell::kValueOffset)); 3027 __ ldr(r4, FieldMemOperand(r3, Cell::kValueOffset));
3057 3028
3058 // Check for deleted property if property can actually be deleted. 3029 // Check for deleted property if property can actually be deleted.
3059 if (!is_dont_delete) { 3030 if (!is_dont_delete) {
3060 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 3031 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
3061 __ cmp(r4, ip); 3032 __ cmp(r4, ip);
3062 __ b(eq, &miss); 3033 __ b(eq, &miss);
3063 } 3034 }
3064 3035
3065 HandlerFrontendFooter(name, &success, &miss); 3036 HandlerFrontendFooter(name, &success, &miss);
3066 __ bind(&success); 3037 __ bind(&success);
3067 3038
3068 Counters* counters = isolate()->counters(); 3039 Counters* counters = isolate()->counters();
3069 __ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3); 3040 __ IncrementCounter(counters->named_load_global_stub(), 1, r1, r3);
3070 __ mov(r0, r4); 3041 __ mov(r0, r4);
3071 __ Ret(); 3042 __ Ret();
3072 3043
3073 // Return the generated code. 3044 // Return the generated code.
3074 return GetICCode(kind(), Code::NORMAL, name); 3045 return GetCode(kind(), Code::NORMAL, name);
3075 } 3046 }
3076 3047
3077 3048
3078 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( 3049 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
3079 MapHandleList* receiver_maps, 3050 MapHandleList* receiver_maps,
3080 CodeHandleList* handlers, 3051 CodeHandleList* handlers,
3081 Handle<Name> name, 3052 Handle<Name> name,
3082 Code::StubType type, 3053 Code::StubType type,
3083 IcCheckType check) { 3054 IcCheckType check) {
3084 Label miss; 3055 Label miss;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3189 // ----------------------------------- 3160 // -----------------------------------
3190 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3161 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3191 } 3162 }
3192 3163
3193 3164
3194 #undef __ 3165 #undef __
3195 3166
3196 } } // namespace v8::internal 3167 } } // namespace v8::internal
3197 3168
3198 #endif // V8_TARGET_ARCH_ARM 3169 #endif // V8_TARGET_ARCH_ARM
OLDNEW
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/array.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698