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...) 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() { | 1372 void Init() { |
danno
2012/04/04 20:47:57
How about putting this directly in SetUpJSCallerSa
Philippe
2012/04/05 11:30:18
Done.
| |
1373 int i = 0; | 1373 int i = 0; |
1374 for (int r = 0; r < kNumRegs; r++) | 1374 for (int r = 0; r < kNumRegs; r++) |
1375 if ((kJSCallerSaved & (1 << r)) != 0) | 1375 if ((kJSCallerSaved & (1 << r)) != 0) |
1376 reg_code[i++] = r; | 1376 reg_code[i++] = r; |
1377 | 1377 |
1378 ASSERT(i == kNumJSCallerSaved); | 1378 ASSERT(i == kNumJSCallerSaved); |
1379 } | 1379 } |
1380 int reg_code[kNumJSCallerSaved]; | 1380 int reg_code[kNumJSCallerSaved]; |
1381 }; | 1381 }; |
1382 | 1382 |
1383 JSCallerSavedCodeData caller_saved_code_data; | |
1383 | 1384 |
1384 static LazyInstance<JSCallerSavedCodeData>::type caller_saved_code_data = | 1385 void SetUpJSCallerSavedCodeData() { |
1385 LAZY_INSTANCE_INITIALIZER; | 1386 caller_saved_code_data.Init(); |
1387 } | |
1386 | 1388 |
1387 int JSCallerSavedCode(int n) { | 1389 int JSCallerSavedCode(int n) { |
1388 ASSERT(0 <= n && n < kNumJSCallerSaved); | 1390 ASSERT(0 <= n && n < kNumJSCallerSaved); |
1389 return caller_saved_code_data.Get().reg_code[n]; | 1391 return caller_saved_code_data.reg_code[n]; |
1390 } | 1392 } |
1391 | 1393 |
1392 | 1394 |
1393 #define DEFINE_WRAPPER(type, field) \ | 1395 #define DEFINE_WRAPPER(type, field) \ |
1394 class field##_Wrapper : public ZoneObject { \ | 1396 class field##_Wrapper : public ZoneObject { \ |
1395 public: /* NOLINT */ \ | 1397 public: /* NOLINT */ \ |
1396 field##_Wrapper(const field& original) : frame_(original) { \ | 1398 field##_Wrapper(const field& original) : frame_(original) { \ |
1397 } \ | 1399 } \ |
1398 field frame_; \ | 1400 field frame_; \ |
1399 }; | 1401 }; |
(...skipping 20 matching lines...) Loading... | |
1420 ZoneList<StackFrame*> list(10); | 1422 ZoneList<StackFrame*> list(10); |
1421 for (StackFrameIterator it; !it.done(); it.Advance()) { | 1423 for (StackFrameIterator it; !it.done(); it.Advance()) { |
1422 StackFrame* frame = AllocateFrameCopy(it.frame()); | 1424 StackFrame* frame = AllocateFrameCopy(it.frame()); |
1423 list.Add(frame); | 1425 list.Add(frame); |
1424 } | 1426 } |
1425 return list.ToVector(); | 1427 return list.ToVector(); |
1426 } | 1428 } |
1427 | 1429 |
1428 | 1430 |
1429 } } // namespace v8::internal | 1431 } } // namespace v8::internal |
OLD | NEW |