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

Side by Side Diff: src/arm/stub-cache-arm.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 | « 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 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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
415 Label* miss_label) { 411 Label* miss_label) {
416 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label); 412 __ TryGetFunctionPrototype(receiver, scratch1, scratch2, miss_label);
417 __ mov(r0, scratch1); 413 __ mov(r0, scratch1);
418 __ Ret(); 414 __ Ret();
419 } 415 }
420 416
421 417
422 // Generate code to check that a global property cell is empty. Create 418 // Generate code to check that a global property cell is empty. Create
423 // the property cell at compilation time if no cell exists for the 419 // the property cell at compilation time if no cell exists for the
424 // property. 420 // property.
425 static void GenerateCheckPropertyCell(MacroAssembler* masm, 421 void StubCompiler::GenerateCheckPropertyCell(MacroAssembler* masm,
426 Handle<GlobalObject> global, 422 Handle<JSGlobalObject> global,
427 Handle<Name> name, 423 Handle<Name> name,
428 Register scratch, 424 Register scratch,
429 Label* miss) { 425 Label* miss) {
430 Handle<Cell> cell = GlobalObject::EnsurePropertyCell(global, name); 426 Handle<Cell> cell = JSGlobalObject::EnsurePropertyCell(global, name);
431 ASSERT(cell->value()->IsTheHole()); 427 ASSERT(cell->value()->IsTheHole());
432 __ mov(scratch, Operand(cell)); 428 __ mov(scratch, Operand(cell));
433 __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset)); 429 __ ldr(scratch, FieldMemOperand(scratch, Cell::kValueOffset));
434 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex); 430 __ LoadRoot(ip, Heap::kTheHoleValueRootIndex);
435 __ cmp(scratch, ip); 431 __ cmp(scratch, ip);
436 __ b(ne, miss); 432 __ b(ne, miss);
437 } 433 }
438 434
439 435
440 void BaseStoreStubCompiler::GenerateNegativeHolderLookup( 436 void BaseStoreStubCompiler::GenerateNegativeHolderLookup(
441 MacroAssembler* masm, 437 MacroAssembler* masm,
442 Handle<JSObject> holder, 438 Handle<JSObject> holder,
443 Register holder_reg, 439 Register holder_reg,
444 Handle<Name> name, 440 Handle<Name> name,
445 Label* miss) { 441 Label* miss) {
446 if (holder->IsJSGlobalObject()) { 442 if (holder->IsJSGlobalObject()) {
447 GenerateCheckPropertyCell( 443 GenerateCheckPropertyCell(
448 masm, Handle<GlobalObject>::cast(holder), name, scratch1(), miss); 444 masm, Handle<JSGlobalObject>::cast(holder), name, scratch1(), miss);
449 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) { 445 } else if (!holder->HasFastProperties() && !holder->IsJSGlobalProxy()) {
450 GenerateDictionaryNegativeLookup( 446 GenerateDictionaryNegativeLookup(
451 masm, miss, holder_reg, name, scratch1(), scratch2()); 447 masm, miss, holder_reg, name, scratch1(), scratch2());
452 } 448 }
453 } 449 }
454 450
455 451
456 // Generate StoreTransition code, value is passed in r0 register. 452 // Generate StoreTransition code, value is passed in r0 register.
457 // When leaving generated code after success, the receiver_reg and name_reg 453 // When leaving generated code after success, the receiver_reg and name_reg
458 // may be clobbered. Upon branch to miss_label, the receiver and name 454 // may be clobbered. Upon branch to miss_label, the receiver and name
(...skipping 662 matching lines...) Expand 10 before | Expand all | Expand 10 after
1121 __ b(ne, interceptor_succeeded); 1117 __ b(ne, interceptor_succeeded);
1122 } 1118 }
1123 1119
1124 StubCompiler* stub_compiler_; 1120 StubCompiler* stub_compiler_;
1125 const ParameterCount& arguments_; 1121 const ParameterCount& arguments_;
1126 Register name_; 1122 Register name_;
1127 Code::ExtraICState extra_ic_state_; 1123 Code::ExtraICState extra_ic_state_;
1128 }; 1124 };
1129 1125
1130 1126
1131 // Calls GenerateCheckPropertyCell for each global object in the prototype chain 1127 void StubCompiler::GenerateCheckPropertyCells(MacroAssembler* masm,
1132 // from object to (but not including) holder. 1128 Handle<JSObject> object,
1133 static void GenerateCheckPropertyCells(MacroAssembler* masm, 1129 Handle<JSObject> holder,
1134 Handle<JSObject> object, 1130 Handle<Name> name,
1135 Handle<JSObject> holder, 1131 Register scratch,
1136 Handle<Name> name, 1132 Label* miss) {
1137 Register scratch,
1138 Label* miss) {
1139 Handle<JSObject> current = object; 1133 Handle<JSObject> current = object;
1140 while (!current.is_identical_to(holder)) { 1134 while (!current.is_identical_to(holder)) {
1141 if (current->IsGlobalObject()) { 1135 if (current->IsJSGlobalObject()) {
1142 GenerateCheckPropertyCell(masm, 1136 GenerateCheckPropertyCell(masm,
1143 Handle<GlobalObject>::cast(current), 1137 Handle<JSGlobalObject>::cast(current),
1144 name, 1138 name,
1145 scratch, 1139 scratch,
1146 miss); 1140 miss);
1147 } 1141 }
1148 current = Handle<JSObject>(JSObject::cast(current->GetPrototype())); 1142 current = Handle<JSObject>(JSObject::cast(current->GetPrototype()));
1149 } 1143 }
1150 } 1144 }
1151 1145
1152 1146
1153 // Convert and store int passed in register ival to IEEE 754 single precision 1147 // Convert and store int passed in register ival to IEEE 754 single precision
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1352 __ ldr(scratch2(), FieldMemOperand(pointer, kValueOffset)); 1346 __ ldr(scratch2(), FieldMemOperand(pointer, kValueOffset));
1353 __ cmp(scratch2(), Operand(callback)); 1347 __ cmp(scratch2(), Operand(callback));
1354 __ b(ne, &miss); 1348 __ b(ne, &miss);
1355 } 1349 }
1356 1350
1357 HandlerFrontendFooter(name, success, &miss); 1351 HandlerFrontendFooter(name, success, &miss);
1358 return reg; 1352 return reg;
1359 } 1353 }
1360 1354
1361 1355
1362 void BaseLoadStubCompiler::NonexistentHandlerFrontend(
1363 Handle<JSObject> object,
1364 Handle<JSObject> last,
1365 Handle<Name> name,
1366 Label* success,
1367 Handle<GlobalObject> global) {
1368 Label miss;
1369
1370 HandlerFrontendHeader(object, receiver(), last, name, &miss);
1371
1372 // If the last object in the prototype chain is a global object,
1373 // check that the global property cell is empty.
1374 if (!global.is_null()) {
1375 GenerateCheckPropertyCell(masm(), global, name, scratch2(), &miss);
1376 }
1377
1378 HandlerFrontendFooter(name, success, &miss);
1379 }
1380
1381
1382 void BaseLoadStubCompiler::GenerateLoadField(Register reg, 1356 void BaseLoadStubCompiler::GenerateLoadField(Register reg,
1383 Handle<JSObject> holder, 1357 Handle<JSObject> holder,
1384 PropertyIndex field, 1358 PropertyIndex field,
1385 Representation representation) { 1359 Representation representation) {
1386 if (!reg.is(receiver())) __ mov(receiver(), reg); 1360 if (!reg.is(receiver())) __ mov(receiver(), reg);
1387 if (kind() == Code::LOAD_IC) { 1361 if (kind() == Code::LOAD_IC) {
1388 LoadFieldStub stub(field.is_inobject(holder), 1362 LoadFieldStub stub(field.is_inobject(holder),
1389 field.translate(holder), 1363 field.translate(holder),
1390 representation); 1364 representation);
1391 GenerateTailCall(masm(), stub.GetCode(isolate())); 1365 GenerateTailCall(masm(), stub.GetCode(isolate()));
(...skipping 1540 matching lines...) Expand 10 before | Expand all | Expand 10 after
2932 2906
2933 // Return the generated code. 2907 // Return the generated code.
2934 return GetICCode(kind(), Code::NORMAL, name); 2908 return GetICCode(kind(), Code::NORMAL, 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 738 matching lines...) Expand 10 before | Expand all | Expand 10 after
3691 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow); 3665 TailCallBuiltin(masm, Builtins::kKeyedStoreIC_Slow);
3692 } 3666 }
3693 } 3667 }
3694 3668
3695 3669
3696 #undef __ 3670 #undef __
3697 3671
3698 } } // namespace v8::internal 3672 } } // namespace v8::internal
3699 3673
3700 #endif // V8_TARGET_ARCH_ARM 3674 #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