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

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

Issue 99923008: Merged r17459, r17462, r17474 into 3.20 branch. (Closed) Base URL: https://v8.googlecode.com/svn/branches/3.20
Patch Set: Created 7 years 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/ia32/stub-cache-ia32.cc ('k') | src/objects.h » ('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 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 Register receiver, 401 Register receiver,
406 Register scratch1, 402 Register scratch1,
407 Register scratch2, 403 Register scratch2,
408 Label* miss_label) { 404 Label* miss_label) {
409 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 405 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
410 __ Ret(USE_DELAY_SLOT); 406 __ Ret(USE_DELAY_SLOT);
411 __ mov(v0, scratch1); 407 __ mov(v0, scratch1);
412 } 408 }
413 409
414 410
415 // Generate code to check that a global property cell is empty. Create 411 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
416 // the property cell at compilation time if no cell exists for the 412 Handle<JSGlobalObject> global,
417 // property. 413 Handle<Name> name,
418 static void GenerateCheckPropertyCell(MacroAssembler* masm, 414 Register scratch,
419 Handle<GlobalObject> global, 415 Label* miss) {
420 Handle<Name> name, 416 Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
421 Register scratch,
422 Label* miss) {
423 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name);
424 ASSERT(cell->value()->IsTheHole()); 417 ASSERT(cell->value()->IsTheHole());
425 __ li(scratch, Operand(cell)); 418 __ li(scratch, Operand(cell));
426 __ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); 419 __ lw(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
427 __ LoadRoot(at, Heap::kTheHoleValueRootIndex); 420 __ LoadRoot(at, Heap::kTheHoleValueRootIndex);
428 __ Branch(miss, ne, scratch, Operand(at)); 421 __ Branch(miss, ne, scratch, Operand(at));
429 } 422 }
430 423
431 424
432 void BaseStoreStubCompiler::GenerateNegativeHolderLookup( 425 void BaseStoreStubCompiler::GenerateNegativeHolderLookup(
433 MacroAssembler* masm, 426 MacroAssembler* masm,
434 Handle<JSObject> holder, 427 Handle<JSObject> holder,
435 Register holder_reg, 428 Register holder_reg,
436 Handle<Name> name, 429 Handle<Name> name,
437 Label* miss) { 430 Label* miss) {
438 if (holder->IsJSGlobalObject()) { 431 if (holder->IsJSGlobalObject()) {
439 GenerateCheckPropertyCell( 432 GenerateCheckPropertyCell(
440 masm, Handle<GlobalObject>::cast(holder), name, scratch1(), miss); 433 masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
441 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { 434 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
442 GenerateDictionaryNegativeLookup( 435 GenerateDictionaryNegativeLookup(
443 masm, miss, holder_reg, name, scratch1(), scratch2()); 436 masm, miss, holder_reg, name, scratch1(), scratch2());
444 } 437 }
445 } 438 }
446 439
447 440
448 // Generate StoreTransition code, value is passed in a0 register. 441 // Generate StoreTransition code, value is passed in a0 register.
449 // After executing generated code, the receiver_reg and name_reg 442 // After executing generated code, the receiver_reg and name_reg
450 // may be clobbered. 443 // may be clobbered.
(...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch)); 1120 __ Branch(interceptor_succeeded, ne, v0, Operand(scratch));
1128 } 1121 }
1129 1122
1130 StubCompiler* stub_compiler_; 1123 StubCompiler* stub_compiler_;
1131 const ParameterCount& arguments_; 1124 const ParameterCount& arguments_;
1132 Register name_; 1125 Register name_;
1133 Code::ExtraICState extra_ic_state_; 1126 Code::ExtraICState extra_ic_state_;
1134 }; 1127 };
1135 1128
1136 1129
1137 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 1130 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
1138 // from object to (but not including) holder. 1131 Handle<JSObject> object,
1139 static void GenerateCheckPropertyCells(MacroAssembler* masm, 1132 Handle<JSObject> holder,
1140 Handle<JSObject> object, 1133 Handle<Name> name,
1141 Handle<JSObject> holder, 1134 Register scratch,
1142 Handle<Name> name, 1135 Label* miss) {
1143 Register scratch,
1144 Label* miss) {
1145 Handle<JSObject> current = object; 1136 Handle<JSObject> current = object;
1146 while (!current.is_identical_to(holder)) { 1137 while (!current.is_identical_to(holder)) {
1147 if (current->IsGlobalObject()) { 1138 if (current->IsJSGlobalObject()) {
1148 GenerateCheckPropertyCell(masm, 1139 GenerateCheckPropertyCell(masm,
1149 Handle<GlobalObject>::cast(current), 1140 Handle<JSGlobalObject>::cast(current),
1150 name, 1141 name,
1151 scratch, 1142 scratch,
1152 miss); 1143 miss);
1153 } 1144 }
1154 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1145 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
1155 } 1146 }
1156 } 1147 }
1157 1148
1158 1149
1159 // Convert and store int passed in register ival to IEEE 754 single precision 1150 // Convert and store int passed in register ival to IEEE 754 single precision
(...skipping 197 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 BaseLoadStubCompiler::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 BaseLoadStubCompiler::GenerateLoadField(Register reg, 1358 void BaseLoadStubCompiler::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()));
(...skipping 1578 matching lines...) Expand 10 before | Expand all | Expand 10 after
2975 2946
2976 // Return the generated code. 2947 // Return the generated code.
2977 return GetICCode(kind(), Code::NORMAL, name); 2948 return GetICCode(kind(), Code::NORMAL, name);
2978 } 2949 }
2979 2950
2980 2951
2981 Handle<Code> LoadStubCompiler::CompileLoadNonexistent( 2952 Handle<Code> LoadStubCompiler::CompileLoadNonexistent(
2982 Handle<JSObject> object, 2953 Handle<JSObject> object,
2983 Handle<JSObject> last, 2954 Handle<JSObject> last,
2984 Handle<Name> name, 2955 Handle<Name> name,
2985 Handle<GlobalObject> global) { 2956 Handle<JSGlobalObject> global) {
2986 Label success; 2957 Label success;
2987 2958
2988 NonexistentHandlerFrontend(object, last, name, &success, global); 2959 NonexistentHandlerFrontend(object, last, name, &success, global);
2989 2960
2990 __ bind(&success); 2961 __ bind(&success);
2991 // Return undefined if maps of the full prototype chain is still the same. 2962 // Return undefined if maps of the full prototype chain is still the same.
2992 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex); 2963 __ LoadRoot(v0, Heap::kUndefinedValueRootIndex);
2993 __ Ret(); 2964 __ Ret();
2994 2965
2995 // Return the generated code. 2966 // Return the generated code.
(...skipping 795 matching lines...) Expand 10 before | Expand all | Expand 10 after
3791 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3762 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3792 } 3763 }
3793 } 3764 }
3794 3765
3795 3766
3796 #undef __ 3767 #undef __
3797 3768
3798 } } // namespace v8::internal 3769 } } // namespace v8::internal
3799 3770
3800 #endif // V8_TARGET_ARCH_MIPS 3771 #endif // V8_TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « src/ia32/stub-cache-ia32.cc ('k') | src/objects.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698