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

Side by Side Diff: src/builtins.cc

Issue 6597029: [Isolates] Merge r 6300:6500 from bleeding_edge to isolates. (Closed) Base URL: http://v8.googlecode.com/svn/branches/experimental/isolates/
Patch Set: Created 9 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
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.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 2006-2008 the V8 project authors. All rights reserved. 1 // Copyright 2006-2008 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 13 matching lines...) Expand all
24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 24 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 25 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 26 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 27
28 #include "v8.h" 28 #include "v8.h"
29 29
30 #include "api.h" 30 #include "api.h"
31 #include "arguments.h" 31 #include "arguments.h"
32 #include "bootstrapper.h" 32 #include "bootstrapper.h"
33 #include "builtins.h" 33 #include "builtins.h"
34 #include "gdb-jit.h"
34 #include "ic-inl.h" 35 #include "ic-inl.h"
35 #include "vm-state-inl.h" 36 #include "vm-state-inl.h"
36 37
37 namespace v8 { 38 namespace v8 {
38 namespace internal { 39 namespace internal {
39 40
40 namespace { 41 namespace {
41 42
42 // Arguments object passed to C++ builtins. 43 // Arguments object passed to C++ builtins.
43 template <BuiltinExtraArguments extra_args> 44 template <BuiltinExtraArguments extra_args>
(...skipping 1206 matching lines...) Expand 10 before | Expand all | Expand 10 after
1250 return HandleApiCallAsFunctionOrConstructor(isolate, true, args); 1251 return HandleApiCallAsFunctionOrConstructor(isolate, true, args);
1251 } 1252 }
1252 1253
1253 1254
1254 static void Generate_LoadIC_ArrayLength(MacroAssembler* masm) { 1255 static void Generate_LoadIC_ArrayLength(MacroAssembler* masm) {
1255 LoadIC::GenerateArrayLength(masm); 1256 LoadIC::GenerateArrayLength(masm);
1256 } 1257 }
1257 1258
1258 1259
1259 static void Generate_LoadIC_StringLength(MacroAssembler* masm) { 1260 static void Generate_LoadIC_StringLength(MacroAssembler* masm) {
1260 LoadIC::GenerateStringLength(masm); 1261 LoadIC::GenerateStringLength(masm, false);
1262 }
1263
1264
1265 static void Generate_LoadIC_StringWrapperLength(MacroAssembler* masm) {
1266 LoadIC::GenerateStringLength(masm, true);
1261 } 1267 }
1262 1268
1263 1269
1264 static void Generate_LoadIC_FunctionPrototype(MacroAssembler* masm) { 1270 static void Generate_LoadIC_FunctionPrototype(MacroAssembler* masm) {
1265 LoadIC::GenerateFunctionPrototype(masm); 1271 LoadIC::GenerateFunctionPrototype(masm);
1266 } 1272 }
1267 1273
1268 1274
1269 static void Generate_LoadIC_Initialize(MacroAssembler* masm) { 1275 static void Generate_LoadIC_Initialize(MacroAssembler* masm) {
1270 LoadIC::GenerateInitialize(masm); 1276 LoadIC::GenerateInitialize(masm);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
1304 static void Generate_KeyedLoadIC_Generic(MacroAssembler* masm) { 1310 static void Generate_KeyedLoadIC_Generic(MacroAssembler* masm) {
1305 KeyedLoadIC::GenerateGeneric(masm); 1311 KeyedLoadIC::GenerateGeneric(masm);
1306 } 1312 }
1307 1313
1308 1314
1309 static void Generate_KeyedLoadIC_String(MacroAssembler* masm) { 1315 static void Generate_KeyedLoadIC_String(MacroAssembler* masm) {
1310 KeyedLoadIC::GenerateString(masm); 1316 KeyedLoadIC::GenerateString(masm);
1311 } 1317 }
1312 1318
1313 1319
1314 static void Generate_KeyedLoadIC_ExternalByteArray(MacroAssembler* masm) {
1315 KeyedLoadIC::GenerateExternalArray(masm, kExternalByteArray);
1316 }
1317
1318
1319 static void Generate_KeyedLoadIC_ExternalUnsignedByteArray(
1320 MacroAssembler* masm) {
1321 KeyedLoadIC::GenerateExternalArray(masm, kExternalUnsignedByteArray);
1322 }
1323
1324
1325 static void Generate_KeyedLoadIC_ExternalShortArray(MacroAssembler* masm) {
1326 KeyedLoadIC::GenerateExternalArray(masm, kExternalShortArray);
1327 }
1328
1329
1330 static void Generate_KeyedLoadIC_ExternalUnsignedShortArray(
1331 MacroAssembler* masm) {
1332 KeyedLoadIC::GenerateExternalArray(masm, kExternalUnsignedShortArray);
1333 }
1334
1335
1336 static void Generate_KeyedLoadIC_ExternalIntArray(MacroAssembler* masm) {
1337 KeyedLoadIC::GenerateExternalArray(masm, kExternalIntArray);
1338 }
1339
1340
1341 static void Generate_KeyedLoadIC_ExternalUnsignedIntArray(
1342 MacroAssembler* masm) {
1343 KeyedLoadIC::GenerateExternalArray(masm, kExternalUnsignedIntArray);
1344 }
1345
1346
1347 static void Generate_KeyedLoadIC_ExternalFloatArray(MacroAssembler* masm) {
1348 KeyedLoadIC::GenerateExternalArray(masm, kExternalFloatArray);
1349 }
1350
1351
1352 static void Generate_KeyedLoadIC_PreMonomorphic(MacroAssembler* masm) { 1320 static void Generate_KeyedLoadIC_PreMonomorphic(MacroAssembler* masm) {
1353 KeyedLoadIC::GeneratePreMonomorphic(masm); 1321 KeyedLoadIC::GeneratePreMonomorphic(masm);
1354 } 1322 }
1355 1323
1356 static void Generate_KeyedLoadIC_IndexedInterceptor(MacroAssembler* masm) { 1324 static void Generate_KeyedLoadIC_IndexedInterceptor(MacroAssembler* masm) {
1357 KeyedLoadIC::GenerateIndexedInterceptor(masm); 1325 KeyedLoadIC::GenerateIndexedInterceptor(masm);
1358 } 1326 }
1359 1327
1360 1328
1361 static void Generate_StoreIC_Initialize(MacroAssembler* masm) { 1329 static void Generate_StoreIC_Initialize(MacroAssembler* masm) {
(...skipping 24 matching lines...) Expand all
1386 static void Generate_StoreIC_GlobalProxy(MacroAssembler* masm) { 1354 static void Generate_StoreIC_GlobalProxy(MacroAssembler* masm) {
1387 StoreIC::GenerateGlobalProxy(masm); 1355 StoreIC::GenerateGlobalProxy(masm);
1388 } 1356 }
1389 1357
1390 1358
1391 static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) { 1359 static void Generate_KeyedStoreIC_Generic(MacroAssembler* masm) {
1392 KeyedStoreIC::GenerateGeneric(masm); 1360 KeyedStoreIC::GenerateGeneric(masm);
1393 } 1361 }
1394 1362
1395 1363
1396 static void Generate_KeyedStoreIC_ExternalByteArray(MacroAssembler* masm) {
1397 KeyedStoreIC::GenerateExternalArray(masm, kExternalByteArray);
1398 }
1399
1400
1401 static void Generate_KeyedStoreIC_ExternalUnsignedByteArray(
1402 MacroAssembler* masm) {
1403 KeyedStoreIC::GenerateExternalArray(masm, kExternalUnsignedByteArray);
1404 }
1405
1406
1407 static void Generate_KeyedStoreIC_ExternalShortArray(MacroAssembler* masm) {
1408 KeyedStoreIC::GenerateExternalArray(masm, kExternalShortArray);
1409 }
1410
1411
1412 static void Generate_KeyedStoreIC_ExternalUnsignedShortArray(
1413 MacroAssembler* masm) {
1414 KeyedStoreIC::GenerateExternalArray(masm, kExternalUnsignedShortArray);
1415 }
1416
1417
1418 static void Generate_KeyedStoreIC_ExternalIntArray(MacroAssembler* masm) {
1419 KeyedStoreIC::GenerateExternalArray(masm, kExternalIntArray);
1420 }
1421
1422
1423 static void Generate_KeyedStoreIC_ExternalUnsignedIntArray(
1424 MacroAssembler* masm) {
1425 KeyedStoreIC::GenerateExternalArray(masm, kExternalUnsignedIntArray);
1426 }
1427
1428
1429 static void Generate_KeyedStoreIC_ExternalFloatArray(MacroAssembler* masm) {
1430 KeyedStoreIC::GenerateExternalArray(masm, kExternalFloatArray);
1431 }
1432
1433
1434 static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) { 1364 static void Generate_KeyedStoreIC_Miss(MacroAssembler* masm) {
1435 KeyedStoreIC::GenerateMiss(masm); 1365 KeyedStoreIC::GenerateMiss(masm);
1436 } 1366 }
1437 1367
1438 1368
1439 static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) { 1369 static void Generate_KeyedStoreIC_Initialize(MacroAssembler* masm) {
1440 KeyedStoreIC::GenerateInitialize(masm); 1370 KeyedStoreIC::GenerateInitialize(masm);
1441 } 1371 }
1442 1372
1443 1373
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
1609 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments); 1539 typedef void (*Generator)(MacroAssembler*, int, BuiltinExtraArguments);
1610 Generator g = FUNCTION_CAST<Generator>(functions[i].generator); 1540 Generator g = FUNCTION_CAST<Generator>(functions[i].generator);
1611 // We pass all arguments to the generator, but it may not use all of 1541 // We pass all arguments to the generator, but it may not use all of
1612 // them. This works because the first arguments are on top of the 1542 // them. This works because the first arguments are on top of the
1613 // stack. 1543 // stack.
1614 g(&masm, functions[i].name, functions[i].extra_args); 1544 g(&masm, functions[i].name, functions[i].extra_args);
1615 // Move the code into the object heap. 1545 // Move the code into the object heap.
1616 CodeDesc desc; 1546 CodeDesc desc;
1617 masm.GetCode(&desc); 1547 masm.GetCode(&desc);
1618 Code::Flags flags = functions[i].flags; 1548 Code::Flags flags = functions[i].flags;
1619 Object* code = 0; 1549 Object* code = NULL;
1620 { 1550 {
1621 // During startup it's OK to always allocate and defer GC to later. 1551 // During startup it's OK to always allocate and defer GC to later.
1622 // This simplifies things because we don't need to retry. 1552 // This simplifies things because we don't need to retry.
1623 AlwaysAllocateScope __scope__; 1553 AlwaysAllocateScope __scope__;
1624 { MaybeObject* maybe_code = 1554 { MaybeObject* maybe_code =
1625 heap->CreateCode(desc, flags, masm.CodeObject()); 1555 heap->CreateCode(desc, flags, masm.CodeObject());
1626 if (!maybe_code->ToObject(&code)) { 1556 if (!maybe_code->ToObject(&code)) {
1627 v8::internal::V8::FatalProcessOutOfMemory("CreateCode"); 1557 v8::internal::V8::FatalProcessOutOfMemory("CreateCode");
1628 } 1558 }
1629 } 1559 }
1630 } 1560 }
1631 // Log the event and add the code to the builtins array. 1561 // Log the event and add the code to the builtins array.
1632 PROFILE(CodeCreateEvent(Logger::BUILTIN_TAG, 1562 PROFILE(CodeCreateEvent(Logger::BUILTIN_TAG,
1633 Code::cast(code), functions[i].s_name)); 1563 Code::cast(code),
1564 functions[i].s_name));
1565 GDBJIT(AddCode(GDBJITInterface::BUILTIN,
1566 functions[i].s_name,
1567 Code::cast(code)));
1634 builtins_[i] = code; 1568 builtins_[i] = code;
1635 #ifdef ENABLE_DISASSEMBLER 1569 #ifdef ENABLE_DISASSEMBLER
1636 if (FLAG_print_builtin_code) { 1570 if (FLAG_print_builtin_code) {
1637 PrintF("Builtin: %s\n", functions[i].s_name); 1571 PrintF("Builtin: %s\n", functions[i].s_name);
1638 Code::cast(code)->Disassemble(functions[i].s_name); 1572 Code::cast(code)->Disassemble(functions[i].s_name);
1639 PrintF("\n"); 1573 PrintF("\n");
1640 } 1574 }
1641 #endif 1575 #endif
1642 } else { 1576 } else {
1643 // Deserializing. The values will be filled in during IterateBuiltins. 1577 // Deserializing. The values will be filled in during IterateBuiltins.
(...skipping 25 matching lines...) Expand all
1669 if (entry->contains(pc)) { 1603 if (entry->contains(pc)) {
1670 return names_[i]; 1604 return names_[i];
1671 } 1605 }
1672 } 1606 }
1673 } 1607 }
1674 return NULL; 1608 return NULL;
1675 } 1609 }
1676 1610
1677 1611
1678 } } // namespace v8::internal 1612 } } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/builtins.h ('k') | src/code-stubs.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698