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

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

Issue 12700006: Replace ICStub for array.length with hydrogen stub (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: New patch Created 7 years, 9 months 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
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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 if (!stub.is_null()) return stub; 226 if (!stub.is_null()) return stub;
227 227
228 LoadStubCompiler compiler(isolate_); 228 LoadStubCompiler compiler(isolate_);
229 Handle<Code> handler = 229 Handle<Code> handler =
230 compiler.CompileLoadField(receiver, holder, name, field); 230 compiler.CompileLoadField(receiver, holder, name, field);
231 JSObject::UpdateMapCodeCache(stub_holder, name, handler); 231 JSObject::UpdateMapCodeCache(stub_holder, name, handler);
232 return handler; 232 return handler;
233 } 233 }
234 234
235 235
236 Handle<Code> StubCache::ComputeLoadArrayLength(Handle<Name> name,
danno 2013/03/12 11:16:16 Instead of adding these, how about just make Compi
237 Handle<JSObject> receiver,
238 Handle<JSObject> holder) {
239 ASSERT(name->Equals(isolate_->heap()->length_string()));
240 if (receiver.is_identical_to(holder)) {
241 FastArrayLengthStub stub(LoadStubCompiler::receiver());
242 return stub.GetCode(isolate_);
243 }
244
245 Handle<JSObject> stub_holder = StubHolder(receiver, holder);
246 Handle<Code> stub = FindStub(
247 name, stub_holder, Code::LOAD_IC, Code::CALLBACKS);
248 if (!stub.is_null()) return stub;
249
250 LoadStubCompiler ic_compiler(isolate_);
251 Handle<Code> ic = ic_compiler.CompileArrayLength(receiver, holder, name);
252 JSObject::UpdateMapCodeCache(stub_holder, name, ic);
253 return ic;
254 }
255
256
236 Handle<Code> StubCache::ComputeLoadCallback( 257 Handle<Code> StubCache::ComputeLoadCallback(
237 Handle<Name> name, 258 Handle<Name> name,
238 Handle<JSObject> receiver, 259 Handle<JSObject> receiver,
239 Handle<JSObject> holder, 260 Handle<JSObject> holder,
240 Handle<ExecutableAccessorInfo> callback) { 261 Handle<ExecutableAccessorInfo> callback) {
241 ASSERT(v8::ToCData<Address>(callback->getter()) != 0); 262 ASSERT(v8::ToCData<Address>(callback->getter()) != 0);
242 Handle<JSObject> stub_holder = StubHolder(receiver, holder); 263 Handle<JSObject> stub_holder = StubHolder(receiver, holder);
243 Handle<Code> stub = FindStub( 264 Handle<Code> stub = FindStub(
244 name, stub_holder, Code::LOAD_IC, Code::CALLBACKS); 265 name, stub_holder, Code::LOAD_IC, Code::CALLBACKS);
245 if (!stub.is_null()) return stub; 266 if (!stub.is_null()) return stub;
(...skipping 1198 matching lines...) Expand 10 before | Expand all | Expand 10 after
1444 1465
1445 1466
1446 Handle<Code> BaseLoadStubCompiler::CompileLoadField(Handle<JSObject> object, 1467 Handle<Code> BaseLoadStubCompiler::CompileLoadField(Handle<JSObject> object,
1447 Handle<JSObject> holder, 1468 Handle<JSObject> holder,
1448 Handle<Name> name, 1469 Handle<Name> name,
1449 PropertyIndex field) { 1470 PropertyIndex field) {
1450 Label miss; 1471 Label miss;
1451 1472
1452 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss); 1473 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss);
1453 1474
1454 LoadFieldStub stub(reg, field.is_inobject(holder), field.translate(holder)); 1475 LoadFieldStub stub(reg, field.is_inobject(holder), field.translate(holder));
danno 2013/03/12 11:16:16 If you make a new method, GetLoadFieldHandler that
1455 GenerateTailCall(stub.GetCode(isolate())); 1476 GenerateTailCall(stub.GetCode(isolate()));
1456 1477
1457 __ bind(&miss); 1478 __ bind(&miss);
1458 GenerateLoadMiss(masm(), kind()); 1479 GenerateLoadMiss(masm(), kind());
1459 1480
1460 // Return the generated code. 1481 // Return the generated code.
1461 return GetCode(kind(), Code::FIELD, name); 1482 return GetCode(kind(), Code::FIELD, name);
1462 } 1483 }
1463 1484
1464 1485
1486 Handle<Code> BaseLoadStubCompiler::CompileArrayLength(Handle<JSObject> object,
1487 Handle<JSObject> holder,
1488 Handle<Name> name) {
1489 ASSERT(name->Equals(isolate()->heap()->length_string()));
1490 Label miss;
1491
1492 Register reg = HandlerFrontendHeader(object, receiver(), holder, name, &miss);
1493 FastArrayLengthStub stub(reg);
1494 GenerateTailCall(stub.GetCode(isolate()));
1495
1496 __ bind(&miss);
1497 GenerateLoadMiss(masm(), kind());
1498
1499 return GetCode(kind(), Code::CALLBACKS, name);
1500 }
1501
1502
1465 Handle<Code> BaseLoadStubCompiler::CompileLoadConstant( 1503 Handle<Code> BaseLoadStubCompiler::CompileLoadConstant(
1466 Handle<JSObject> object, 1504 Handle<JSObject> object,
1467 Handle<JSObject> holder, 1505 Handle<JSObject> holder,
1468 Handle<Name> name, 1506 Handle<Name> name,
1469 Handle<JSFunction> value) { 1507 Handle<JSFunction> value) {
1470 Label success; 1508 Label success;
1471 HandlerFrontend(object, receiver(), holder, name, &success); 1509 HandlerFrontend(object, receiver(), holder, name, &success);
1472 __ bind(&success); 1510 __ bind(&success);
1473 GenerateLoadConstant(value); 1511 GenerateLoadConstant(value);
1474 1512
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after
1877 Handle<FunctionTemplateInfo>( 1915 Handle<FunctionTemplateInfo>(
1878 FunctionTemplateInfo::cast(signature->receiver())); 1916 FunctionTemplateInfo::cast(signature->receiver()));
1879 } 1917 }
1880 } 1918 }
1881 1919
1882 is_simple_api_call_ = true; 1920 is_simple_api_call_ = true;
1883 } 1921 }
1884 1922
1885 1923
1886 } } // namespace v8::internal 1924 } } // namespace v8::internal
OLDNEW
« src/objects.cc ('K') | « src/stub-cache.h ('k') | src/x64/code-stubs-x64.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698