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

Side by Side Diff: src/mips/stub-cache-mips.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/mips/macro-assembler-mips.cc ('k') | src/mksnapshot.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 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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 110
111 // Jump to the first instruction in the code stub. 111 // Jump to the first instruction in the code stub.
112 __ Addu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag)); 112 __ Addu(at, code, Operand(Code::kHeaderSize - kHeapObjectTag));
113 __ Jump(at); 113 __ Jump(at);
114 114
115 // Miss: fall through. 115 // Miss: fall through.
116 __ bind(&miss); 116 __ bind(&miss);
117 } 117 }
118 118
119 119
120 // Helper function used to check that the dictionary doesn't contain 120 void StubCompiler::GenerateDictionaryNegativeLookup(MacroAssembler* masm,
121 // the property. This function may return false negatives, so miss_label 121 Label* miss_label,
122 // must always call a backup property check that is complete. 122 Register receiver,
123 // This function is safe to call if the receiver has fast properties. 123 Handle<Name> name,
124 // Name must be unique and receiver must be a heap object. 124 Register scratch0,
125 static void GenerateDictionaryNegativeLookup(MacroAssembler* masm, 125 Register scratch1) {
126 Label* miss_label,
127 Register receiver,
128 Handle<Name> name,
129 Register scratch0,
130 Register scratch1) {
131 ASSERT(name->IsUniqueName()); 126 ASSERT(name->IsUniqueName());
127 ASSERT(!receiver.is(scratch0));
132 Counters* counters = masm->isolate()->counters(); 128 Counters* counters = masm->isolate()->counters();
133 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1); 129 __ IncrementCounter(counters->negative_lookups(), 1, scratch0, scratch1);
134 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1); 130 __ IncrementCounter(counters->negative_lookups_miss(), 1, scratch0, scratch1);
135 131
136 Label done; 132 Label done;
137 133
138 const int kInterceptorOrAccessCheckNeededMask = 134 const int kInterceptorOrAccessCheckNeededMask =
139 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded); 135 (1 << Map::kHasNamedInterceptor) | (1 << Map::kIsAccessCheckNeeded);
140 136
141 // Bail out if the receiver has a named interceptor or requires access checks. 137 // Bail out if the receiver has a named interceptor or requires access checks.
(...skipping 259 matching lines...) Expand 10 before | Expand all | Expand 10 after
401 Register receiver, 397 Register receiver,
402 Register scratch1, 398 Register scratch1,
403 Register scratch2, 399 Register scratch2,
404 Label* miss_label) { 400 Label* miss_label) {
405 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 401 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
406 __ Ret(USE_DELAY_SLOT); 402 __ Ret(USE_DELAY_SLOT);
407 __ mov(v0, scratch1); 403 __ mov(v0, scratch1);
408 } 404 }
409 405
410 406
411 // Generate code to check that a global property cell is empty. Create 407 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
412 // the property cell at compilation time if no cell exists for the 408 Handle<JSGlobalObject> global,
413 // property. 409 Handle<Name> name,
414 static void GenerateCheckPropertyCell(MacroAssembler* masm, 410 Register scratch,
415 Handle<GlobalObject> global, 411 Label* miss) {
416 Handle<Name> name, 412 Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
417 Register scratch,
418 Label* miss) {
419 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name);
420 ASSERT(cell->value()->IsTheHole()); 413 ASSERT(cell->value()->IsTheHole());
421 __ li(scratch, Operand(cell)); 414 __ li(scratch, Operand(cell));
422 __ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); 415 __ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
423 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 416 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
424 __ Branch(miss, ne, scratch, Operand(at)); 417 __ Branch(miss, ne, scratch, Operand(at));
425 } 418 }
426 419
427 420
428 void StoreStubCompiler::GenerateNegativeHolderLookup( 421 void StoreStubCompiler::GenerateNegativeHolderLookup(
429 MacroAssembler* masm, 422 MacroAssembler* masm,
430 Handle<JSObject> holder, 423 Handle<JSObject> holder,
431 Register holder_reg, 424 Register holder_reg,
432 Handle<Name> name, 425 Handle<Name> name,
433 Label* miss) { 426 Label* miss) {
434 if (holder->IsJSGlobalObject()) { 427 if (holder->IsJSGlobalObject()) {
435 GenerateCheckPropertyCell( 428 GenerateCheckPropertyCell(
436 masm, Handle<GlobalObject>::cast(holder), name, scratch1(), miss); 429 masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
437 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { 430 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
438 GenerateDictionaryNegativeLookup( 431 GenerateDictionaryNegativeLookup(
439 masm, miss, holder_reg, name, scratch1(), scratch2()); 432 masm, miss, holder_reg, name, scratch1(), scratch2());
440 } 433 }
441 } 434 }
442 435
443 436
444 // Generate StoreTransition code, value is passed in a0 register. 437 // Generate StoreTransition code, value is passed in a0 register.
445 // After executing generated code, the receiver_reg and name_reg 438 // After executing generated code, the receiver_reg and name_reg
446 // may be clobbered. 439 // may be clobbered.
(...skipping 14 matching lines...) Expand all
461 Label exit; 454 Label exit;
462 455
463 int descriptor = transition->LastAdded(); 456 int descriptor = transition->LastAdded();
464 DescriptorArray* descriptors = transition->instance_descriptors(); 457 DescriptorArray* descriptors = transition->instance_descriptors();
465 PropertyDetails details = descriptors->GetDetails(descriptor); 458 PropertyDetails details = descriptors->GetDetails(descriptor);
466 Representation representation = details.representation(); 459 Representation representation = details.representation();
467 ASSERT(!representation.IsNone()); 460 ASSERT(!representation.IsNone());
468 461
469 if (details.type() == CONSTANT) { 462 if (details.type() == CONSTANT) {
470 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate()); 463 Handle<Object> constant(descriptors->GetValue(descriptor), masm->isolate());
471 __ LoadObject(scratch1, constant); 464 __ li(scratch1, constant);
472 __ Branch(miss_label, ne, value_reg, Operand(scratch1)); 465 __ Branch(miss_label, ne, value_reg, Operand(scratch1));
473 } else if (FLAG_track_fields && representation.IsSmi()) { 466 } else if (FLAG_track_fields && representation.IsSmi()) {
474 __ JumpIfNotSmi(value_reg, miss_label); 467 __ JumpIfNotSmi(value_reg, miss_label);
475 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) { 468 } else if (FLAG_track_heap_object_fields && representation.IsHeapObject()) {
476 __ JumpIfSmi(value_reg, miss_label); 469 __ JumpIfSmi(value_reg, miss_label);
477 } else if (FLAG_track_double_fields && representation.IsDouble()) { 470 } else if (FLAG_track_double_fields && representation.IsDouble()) {
478 Label do_store, heap_number; 471 Label do_store, heap_number;
479 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex); 472 __ LoadRoot(scratch3, Heap::kHeapNumberMapRootIndex);
480 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow); 473 __ AllocateHeapNumber(storage_reg, scratch1, scratch2, scratch3, slow);
481 474
(...skipping 355 matching lines...) Expand 10 before | Expand all | Expand 10 after
837 // -- sp[28] : last JS argument 830 // -- sp[28] : last JS argument
838 // -- ... 831 // -- ...
839 // -- sp[(argc + 6) * 4] : first JS argument 832 // -- sp[(argc + 6) * 4] : first JS argument
840 // -- sp[(argc + 7) * 4] : receiver 833 // -- sp[(argc + 7) * 4] : receiver
841 // ----------------------------------- 834 // -----------------------------------
842 typedef FunctionCallbackArguments FCA; 835 typedef FunctionCallbackArguments FCA;
843 // Save calling context. 836 // Save calling context.
844 __ sw(cp, MemOperand(sp, FCA::kContextSaveIndex * kPointerSize)); 837 __ sw(cp, MemOperand(sp, FCA::kContextSaveIndex * kPointerSize));
845 // Get the function and setup the context. 838 // Get the function and setup the context.
846 Handle<JSFunction> function = optimization.constant_function(); 839 Handle<JSFunction> function = optimization.constant_function();
847 __ LoadHeapObject(t1, function); 840 __ li(t1, function);
848 __ lw(cp, FieldMemOperand(t1, JSFunction::kContextOffset)); 841 __ lw(cp, FieldMemOperand(t1, JSFunction::kContextOffset));
849 __ sw(t1, MemOperand(sp, FCA::kCalleeIndex * kPointerSize)); 842 __ sw(t1, MemOperand(sp, FCA::kCalleeIndex * kPointerSize));
850 843
851 // Construct the FunctionCallbackInfo. 844 // Construct the FunctionCallbackInfo.
852 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info(); 845 Handle<CallHandlerInfo> api_call_info = optimization.api_call_info();
853 Handle<Object> call_data(api_call_info->data(), masm->isolate()); 846 Handle<Object> call_data(api_call_info->data(), masm->isolate());
854 if (masm->isolate()->heap()->InNewSpace(*call_data)) { 847 if (masm->isolate()->heap()->InNewSpace(*call_data)) {
855 __ li(a0, api_call_info); 848 __ li(a0, api_call_info);
856 __ lw(t2, FieldMemOperand(a0, CallHandlerInfo::kDataOffset)); 849 __ lw(t2, FieldMemOperand(a0, CallHandlerInfo::kDataOffset));
857 } else { 850 } else {
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after
1142 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch)); 1135 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch));
1143 } 1136 }
1144 1137
1145 StubCompiler* stub_compiler_; 1138 StubCompiler* stub_compiler_;
1146 const ParameterCount& arguments_; 1139 const ParameterCount& arguments_;
1147 Register name_; 1140 Register name_;
1148 Code::ExtraICState extra_ic_state_; 1141 Code::ExtraICState extra_ic_state_;
1149 }; 1142 };
1150 1143
1151 1144
1152 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 1145 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
1153 // from object to (but not including) holder. 1146 Handle<JSObject> object,
1154 static void GenerateCheckPropertyCells(MacroAssembler* masm, 1147 Handle<JSObject> holder,
1155 Handle<JSObject> object, 1148 Handle<Name> name,
1156 Handle<JSObject> holder, 1149 Register scratch,
1157 Handle<Name> name, 1150 Label* miss) {
1158 Register scratch,
1159 Label* miss) {
1160 Handle<JSObject> current = object; 1151 Handle<JSObject> current = object;
1161 while (!current.is_identical_to(holder)) { 1152 while (!current.is_identical_to(holder)) {
1162 if (current->IsGlobalObject()) { 1153 if (current->IsJSGlobalObject()) {
1163 GenerateCheckPropertyCell(masm, 1154 GenerateCheckPropertyCell(masm,
1164 Handle<GlobalObject>::cast(current), 1155 Handle<JSGlobalObject>::cast(current),
1165 name, 1156 name,
1166 scratch, 1157 scratch,
1167 miss); 1158 miss);
1168 } 1159 }
1169 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1160 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
1170 } 1161 }
1171 } 1162 }
1172 1163
1173 1164
1174 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) { 1165 void StubCompiler::GenerateTailCall(MacroAssembler* masm, Handle<Code> code) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1357 const int kValueOffset = kElementsStartOffset + kPointerSize; 1348 const int kValueOffset = kElementsStartOffset + kPointerSize;
1358 __ lw(scratch2(), FieldMemOperand(pointer, kValueOffset)); 1349 __ lw(scratch2(), FieldMemOperand(pointer, kValueOffset));
1359 __ Branch(&miss, ne, scratch2(), Operand(callback)); 1350 __ Branch(&miss, ne, scratch2(), Operand(callback));
1360 } 1351 }
1361 1352
1362 HandlerFrontendFooter(name, success, &miss); 1353 HandlerFrontendFooter(name, success, &miss);
1363 return reg; 1354 return reg;
1364 } 1355 }
1365 1356
1366 1357
1367 void LoadStubCompiler::NonexistentHandlerFrontend(
1368 Handle<JSObject> object,
1369 Handle<JSObject> last,
1370 Handle<Name> name,
1371 Label* success,
1372 Handle<GlobalObject> global) {
1373 Label miss;
1374
1375 HandlerFrontendHeader(object, receiver(), last, name, &miss);
1376
1377 // If the last object in the prototype chain is a global object,
1378 // check that the global property cell is empty.
1379 if (!global.is_null()) {
1380 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
1381 }
1382
1383 HandlerFrontendFooter(name, success, &miss);
1384 }
1385
1386
1387 void LoadStubCompiler::GenerateLoadField(Register reg, 1358 void LoadStubCompiler::GenerateLoadField(Register reg,
1388 Handle<JSObject> holder, 1359 Handle<JSObject> holder,
1389 PropertyIndex field, 1360 PropertyIndex field,
1390 Representation representation) { 1361 Representation representation) {
1391 if (!reg.is(receiver())) __ mov(receiver(), reg); 1362 if (!reg.is(receiver())) __ mov(receiver(), reg);
1392 if (kind() == Code::LOAD_IC) { 1363 if (kind() == Code::LOAD_IC) {
1393 LoadFieldStub stub(field.is_inobject(holder), 1364 LoadFieldStub stub(field.is_inobject(holder),
1394 field.translate(holder), 1365 field.translate(holder),
1395 representation); 1366 representation);
1396 GenerateTailCall(masm(), stub.GetCode(isolate())); 1367 GenerateTailCall(masm(), stub.GetCode(isolate()));
1397 } else { 1368 } else {
1398 KeyedLoadFieldStub stub(field.is_inobject(holder), 1369 KeyedLoadFieldStub stub(field.is_inobject(holder),
1399 field.translate(holder), 1370 field.translate(holder),
1400 representation); 1371 representation);
1401 GenerateTailCall(masm(), stub.GetCode(isolate())); 1372 GenerateTailCall(masm(), stub.GetCode(isolate()));
1402 } 1373 }
1403 } 1374 }
1404 1375
1405 1376
1406 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) { 1377 void LoadStubCompiler::GenerateLoadConstant(Handle<Object> value) {
1407 // Return the constant value. 1378 // Return the constant value.
1408 __ LoadObject(v0, value); 1379 __ li(v0, value);
1409 __ Ret(); 1380 __ Ret();
1410 } 1381 }
1411 1382
1412 1383
1413 void LoadStubCompiler::GenerateLoadCallback( 1384 void LoadStubCompiler::GenerateLoadCallback(
1414 const CallOptimization& call_optimization) { 1385 const CallOptimization& call_optimization) {
1415 GenerateFastApiCall( 1386 GenerateFastApiCall(
1416 masm(), call_optimization, receiver(), scratch3(), 0, NULL); 1387 masm(), call_optimization, receiver(), scratch3(), 0, NULL);
1417 } 1388 }
1418 1389
(...skipping 1531 matching lines...) Expand 10 before | Expand all | Expand 10 after
2950 2921
2951 // Return the generated code. 2922 // Return the generated code.
2952 return GetCode(kind(), Code::INTERCEPTOR, name); 2923 return GetCode(kind(), Code::INTERCEPTOR, name);
2953 } 2924 }
2954 2925
2955 2926
2956 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( 2927 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
2957 Handle<JSObject> object, 2928 Handle<JSObject> object,
2958 Handle<JSObject> last, 2929 Handle<JSObject> last,
2959 Handle<Name> name, 2930 Handle<Name> name,
2960 Handle<GlobalObject> global) { 2931 Handle<JSGlobalObject> global) {
2961 Label success; 2932 Label success;
2962 2933
2963 NonexistentHandlerFrontend(object, last, name, &success, global); 2934 NonexistentHandlerFrontend(object, last, name, &success, global);
2964 2935
2965 __ bind(&success); 2936 __ bind(&success);
2966 // Return undefined if maps of the full prototype chain is still the same. 2937 // Return undefined if maps of the full prototype chain is still the same.
2967 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 2938 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
2968 __ Ret(); 2939 __ Ret();
2969 2940
2970 // Return the generated code. 2941 // Return the generated code.
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
3054 3025
3055 3026
3056 Handle<Code> LoadStubCompiler::CompileLoadGlobal( 3027 Handle<Code> LoadStubCompiler::CompileLoadGlobal(
3057 Handle<JSObject> object, 3028 Handle<JSObject> object,
3058 Handle<GlobalObject> global, 3029 Handle<GlobalObject> global,
3059 Handle<PropertyCell> cell, 3030 Handle<PropertyCell> cell,
3060 Handle<Name> name, 3031 Handle<Name> name,
3061 bool is_dont_delete) { 3032 bool is_dont_delete) {
3062 Label success, miss; 3033 Label success, miss;
3063 3034
3064 __ CheckMap( 3035 HandlerFrontendHeader(object, receiver(), global, name, &miss);
3065 receiver(), scratch1(), Handle<Map>(object->map()), &miss, DO_SMI_CHECK);
3066 HandlerFrontendHeader(
3067 object, receiver(), Handle<JSObject>::cast(global), name, &miss);
3068 3036
3069 // Get the value from the cell. 3037 // Get the value from the cell.
3070 __ li(a3, Operand(cell)); 3038 __ li(a3, Operand(cell));
3071 __ lw(t0, FieldMemOperand(a3, Cell::kValueOffset)); 3039 __ lw(t0, FieldMemOperand(a3, Cell::kValueOffset));
3072 3040
3073 // Check for deleted property if property can actually be deleted. 3041 // Check for deleted property if property can actually be deleted.
3074 if (!is_dont_delete) { 3042 if (!is_dont_delete) {
3075 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 3043 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
3076 __ Branch(&miss, eq, t0, Operand(at)); 3044 __ Branch(&miss, eq, t0, Operand(at));
3077 } 3045 }
3078 3046
3079 HandlerFrontendFooter(name, &success, &miss); 3047 HandlerFrontendFooter(name, &success, &miss);
3080 __ bind(&success); 3048 __ bind(&success);
3081 3049
3082 Counters* counters = isolate()->counters(); 3050 Counters* counters = isolate()->counters();
3083 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3); 3051 __ IncrementCounter(counters->named_load_global_stub(), 1, a1, a3);
3084 __ Ret(USE_DELAY_SLOT); 3052 __ Ret(USE_DELAY_SLOT);
3085 __ mov(v0, t0); 3053 __ mov(v0, t0);
3086 3054
3087 // Return the generated code. 3055 // Return the generated code.
3088 return GetICCode(kind(), Code::NORMAL, name); 3056 return GetCode(kind(), Code::NORMAL, name);
3089 } 3057 }
3090 3058
3091 3059
3092 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC( 3060 Handle<Code> BaseLoadStoreStubCompiler::CompilePolymorphicIC(
3093 MapHandleList* receiver_maps, 3061 MapHandleList* receiver_maps,
3094 CodeHandleList* handlers, 3062 CodeHandleList* handlers,
3095 Handle<Name> name, 3063 Handle<Name> name,
3096 Code::StubType type, 3064 Code::StubType type,
3097 IcCheckType check) { 3065 IcCheckType check) {
3098 Label miss; 3066 Label miss;
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
3203 // ----------------------------------- 3171 // -----------------------------------
3204 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric); 3172 TailCallBuiltin(masm, Builtins::kKeyedLoadIC_MissForceGeneric);
3205 } 3173 }
3206 3174
3207 3175
3208 #undef __ 3176 #undef __
3209 3177
3210 } } // namespace v8::internal 3178 } } // namespace v8::internal
3211 3179
3212 #endif // V8_TARGET_ARCH_MIPS 3180 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/mips/macro-assembler-mips.cc ('k') | src/mksnapshot.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698