OLD | NEW |
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 1351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1362 int n = 0; | 1362 int n = 0; |
1363 while (reglist != 0) { | 1363 while (reglist != 0) { |
1364 n++; | 1364 n++; |
1365 reglist &= reglist - 1; // clear one bit | 1365 reglist &= reglist - 1; // clear one bit |
1366 } | 1366 } |
1367 return n; | 1367 return n; |
1368 } | 1368 } |
1369 | 1369 |
1370 | 1370 |
1371 struct JSCallerSavedCodeData { | 1371 struct JSCallerSavedCodeData { |
1372 JSCallerSavedCodeData() { | |
1373 int i = 0; | |
1374 for (int r = 0; r < kNumRegs; r++) | |
1375 if ((kJSCallerSaved & (1 << r)) != 0) | |
1376 reg_code[i++] = r; | |
1377 | |
1378 ASSERT(i == kNumJSCallerSaved); | |
1379 } | |
1380 int reg_code[kNumJSCallerSaved]; | 1372 int reg_code[kNumJSCallerSaved]; |
1381 }; | 1373 }; |
1382 | 1374 |
| 1375 JSCallerSavedCodeData caller_saved_code_data; |
1383 | 1376 |
1384 static LazyInstance<JSCallerSavedCodeData>::type caller_saved_code_data = | 1377 void SetUpJSCallerSavedCodeData() { |
1385 LAZY_INSTANCE_INITIALIZER; | 1378 int i = 0; |
| 1379 for (int r = 0; r < kNumRegs; r++) |
| 1380 if ((kJSCallerSaved & (1 << r)) != 0) |
| 1381 caller_saved_code_data.reg_code[i++] = r; |
| 1382 |
| 1383 ASSERT(i == kNumJSCallerSaved); |
| 1384 } |
1386 | 1385 |
1387 int JSCallerSavedCode(int n) { | 1386 int JSCallerSavedCode(int n) { |
1388 ASSERT(0 <= n && n < kNumJSCallerSaved); | 1387 ASSERT(0 <= n && n < kNumJSCallerSaved); |
1389 return caller_saved_code_data.Get().reg_code[n]; | 1388 return caller_saved_code_data.reg_code[n]; |
1390 } | 1389 } |
1391 | 1390 |
1392 | 1391 |
1393 #define DEFINE_WRAPPER(type, field) \ | 1392 #define DEFINE_WRAPPER(type, field) \ |
1394 class field##_Wrapper : public ZoneObject { \ | 1393 class field##_Wrapper : public ZoneObject { \ |
1395 public: /* NOLINT */ \ | 1394 public: /* NOLINT */ \ |
1396 field##_Wrapper(const field& original) : frame_(original) { \ | 1395 field##_Wrapper(const field& original) : frame_(original) { \ |
1397 } \ | 1396 } \ |
1398 field frame_; \ | 1397 field frame_; \ |
1399 }; | 1398 }; |
(...skipping 20 matching lines...) Expand all Loading... |
1420 ZoneList<StackFrame*> list(10); | 1419 ZoneList<StackFrame*> list(10); |
1421 for (StackFrameIterator it; !it.done(); it.Advance()) { | 1420 for (StackFrameIterator it; !it.done(); it.Advance()) { |
1422 StackFrame* frame = AllocateFrameCopy(it.frame()); | 1421 StackFrame* frame = AllocateFrameCopy(it.frame()); |
1423 list.Add(frame); | 1422 list.Add(frame); |
1424 } | 1423 } |
1425 return list.ToVector(); | 1424 return list.ToVector(); |
1426 } | 1425 } |
1427 | 1426 |
1428 | 1427 |
1429 } } // namespace v8::internal | 1428 } } // namespace v8::internal |
OLD | NEW |